diff --git a/app/assets/images/delete.png b/app/assets/images/delete.png new file mode 100644 index 00000000..9e290c1f Binary files /dev/null and b/app/assets/images/delete.png differ diff --git a/app/assets/images/go-arrow-2.png b/app/assets/images/go-arrow-2.png new file mode 100644 index 00000000..646b6451 Binary files /dev/null and b/app/assets/images/go-arrow-2.png differ diff --git a/app/assets/images/go-arrow.png b/app/assets/images/go-arrow.png index 74181fe8..90944b62 100644 Binary files a/app/assets/images/go-arrow.png and b/app/assets/images/go-arrow.png differ diff --git a/app/assets/images/minus.png b/app/assets/images/minus.png new file mode 100644 index 00000000..802a9fc4 Binary files /dev/null and b/app/assets/images/minus.png differ diff --git a/app/assets/images/removeFromCanvas.png b/app/assets/images/removeFromCanvas.png new file mode 100644 index 00000000..dbe1af4f Binary files /dev/null and b/app/assets/images/removeFromCanvas.png differ diff --git a/app/assets/images/removeFromMap.png b/app/assets/images/removeFromMap.png new file mode 100644 index 00000000..5b95117f Binary files /dev/null and b/app/assets/images/removeFromMap.png differ diff --git a/app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png b/app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 00000000..5b5dab2a Binary files /dev/null and b/app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png b/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 00000000..ad3d6346 Binary files /dev/null and b/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/app/assets/images/ui-bg_glass_65_ffffff_1x400.png b/app/assets/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 00000000..42ccba26 Binary files /dev/null and b/app/assets/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/app/assets/images/ui-bg_glass_75_dadada_1x400.png b/app/assets/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 00000000..5a46b47c Binary files /dev/null and b/app/assets/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png b/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 00000000..86c2baa6 Binary files /dev/null and b/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png b/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 00000000..4443fdc1 Binary files /dev/null and b/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 00000000..7c9fa6c6 Binary files /dev/null and b/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/app/assets/images/ui-icons_222222_256x240.png b/app/assets/images/ui-icons_222222_256x240.png new file mode 100644 index 00000000..b273ff11 Binary files /dev/null and b/app/assets/images/ui-icons_222222_256x240.png differ diff --git a/app/assets/images/ui-icons_2e83ff_256x240.png b/app/assets/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 00000000..09d1cdc8 Binary files /dev/null and b/app/assets/images/ui-icons_2e83ff_256x240.png differ diff --git a/app/assets/images/ui-icons_454545_256x240.png b/app/assets/images/ui-icons_454545_256x240.png new file mode 100644 index 00000000..59bd45b9 Binary files /dev/null and b/app/assets/images/ui-icons_454545_256x240.png differ diff --git a/app/assets/images/ui-icons_888888_256x240.png b/app/assets/images/ui-icons_888888_256x240.png new file mode 100644 index 00000000..6d02426c Binary files /dev/null and b/app/assets/images/ui-icons_888888_256x240.png differ diff --git a/app/assets/images/ui-icons_cd0a0a_256x240.png b/app/assets/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 00000000..2ab019b7 Binary files /dev/null and b/app/assets/images/ui-icons_cd0a0a_256x240.png differ diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js index 30eda4fb..330a6b20 100644 --- a/app/assets/javascripts/Jit/graphsettings.js +++ b/app/assets/javascripts/Jit/graphsettings.js @@ -532,7 +532,6 @@ function onCreateLabelHandler(domElement, node) { var html = ' \
\ - close \

$_metacode_$

\ $_metacode_$ \ @@ -553,7 +553,7 @@ function onCreateLabelHandler(domElement, node) { data-type="input">$_name_$ \ \ \ \
\ @@ -570,7 +570,7 @@ function onCreateLabelHandler(domElement, node) { data-attribute="desc" \ data-type="textarea">$_desc_$ \
\ - \ + \ \ '; + var littleHTML = ' \ +
$_name_$
\ +
'; + if (mapid == null) { + littleHTML += ' \ + \ + '; + } + else if (mapid != null && userid != null) { + littleHTML += ' \ + \ + '; + } + if (userid != null) { + littleHTML += ' \ + \ + '; + } + littleHTML += '
'; + littleHTML = littleHTML.replace(/\$_id_\$/g, node.id); + littleHTML = littleHTML.replace(/\$_mapid_\$/g, mapid); + littleHTML = littleHTML.replace(/\$_name_\$/g, node.name); + nameContainer.innerHTML = littleHTML; domElement.appendChild(nameContainer); style.fontSize = "0.9em"; style.color = "#222222"; // add some events to the label - nameContainer.onclick = function(){ + $(nameContainer).find('.label').click(function(){ selectNodeOnClickHandler(node) + }); + + nameContainer.onmouseover = function(){ + $('.name.topic_' + node.id + ' .nodeOptions').css('display','block'); } + + nameContainer.onmouseout = function(){ + $('.name.topic_' + node.id + ' .nodeOptions').css('display','none'); + } + //bind callbacks $(showCard).find('.type.best_in_place').bind("ajax:success", function() { diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4c057ec0..86ffa8b5 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -21,7 +21,7 @@ // other options are 'graph' var viewMode = "list"; -var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false; +var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, gType, tempNode = null, tempInit = false, tempNode2 = null, metacodeIMGinit = false, findOpen = false, analyzeOpen = false, organizeOpen = false, goRealtime = false, mapid = null; $(document).ready(function() { @@ -54,7 +54,6 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, if (! sliding1) { sliding1 = true; if (userid != null) { - $('.footer .menu').css('border','1px solid #000'); $('.footer .menu').animate({ height: '252px' }, 300, function() { @@ -78,7 +77,6 @@ var labelType, useGradients, nativeTextSupport, animate, json, Mconsole = null, height: '0px' }, 300, function() { sliding1 = false; - $('.footer .menu').css('border','none'); }); } },800); @@ -125,6 +123,23 @@ function saveToMap() { $('#new_map').fadeIn('fast'); } + +// this is for hiding one topic from your canvas +function removeFromCanvas(topic_id) { + var node = Mconsole.graph.getNode(topic_id); + node.setData('alpha', 0, 'end'); + node.eachAdjacency(function(adj) { + adj.setData('alpha', 0, 'end'); + }); + Mconsole.fx.animate({ + modes: ['node-property:alpha', + 'edge-property:alpha'], + duration: 1000 + }); + Mconsole.graph.removeNode(topic_id); + Mconsole.labels.disposeLabel(topic_id); +} + function addMetacode() { // code from http://www.professorcloud.com/mainsite/carousel-integration.htm //mouseWheel:true, diff --git a/app/assets/stylesheets/topics.css.scss b/app/assets/stylesheets/topics.css.scss index ecf313fb..6ed2b6b6 100644 --- a/app/assets/stylesheets/topics.css.scss +++ b/app/assets/stylesheets/topics.css.scss @@ -1,58 +1,97 @@ -// Place all the styles related to the Topics controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ - -.topic { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; } - -.close-link, -.topic .delete { -position: absolute; -top: -14px; -left: 0px; -background: none; -border: 0; -color: white; -border: none; -font-size: 14px; -margin: 0; -padding: 0; -cursor:pointer; -} - -.topic .scroll { display:block; height:283px; } - -.topic .type {position: absolute; -color: white; -top: -22px; -right: 0; -font-weight: bold; -font-size: 20px; -line-height: 24px;} - -.topic .icon { position:absolute; top:135px; left:-25px; } - -.topic .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; } - -.topic .desc { font-size:15px; font-family:Arial, Helvetica, sans-serif; } -.topic .desc h3 { font-style:normal; margin-top:5px; } - -.topic .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } - -.best_in_place_name { - max-width:130px; - float:left; -} - -.best_in_place_name input{ - max-width:130px; -} - -.topic-go-arrow { - width: 1em; - height: 1em; - float: right; -} - -.gray { - color: #999999; -} +// Place all the styles related to the Topics controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + +.nodeOptions { + display:none; + position: absolute; + top: -5px; + right: -17px; +} + +.onCanvas .removeFromMap { + display:none !important; +} + +.onMap .removeFromCanvas { + display:none !important; +} + +.unauthenticated .deleteTopic { + display:none !important; +} + +.removeFromCanvas { + display: block; + width: 17px; + height: 16px; + background: url('removeFromCanvas.png') no-repeat 2px 0; +} + +.removeFromMap { + display: block; + width: 17px; + height: 16px; + background: url('removeFromMap.png') no-repeat 2px 0; +} + +.deleteTopic { + display: block; + width: 17px; + height: 16px; + background: url('delete.png') no-repeat 2px 0; +} + +.topic { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; } + +.topic .delete { +position: absolute; +top: -14px; +left: 0px; +background: none; +border: 0; +color: white; +border: none; +font-size: 14px; +margin: 0; +padding: 0; +cursor:pointer; +} + +.topic .scroll { display:block; height:283px; } + +.topic .type {position: absolute; +color: white; +top: -22px; +right: 0; +font-weight: bold; +font-size: 20px; +line-height: 24px;} + +.topic .icon { position:absolute; top:135px; left:-25px; } + +.topic .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; } + +.topic .desc { font-size:15px; font-family:Arial, Helvetica, sans-serif; } +.topic .desc h3 { font-style:normal; margin-top:5px; } + +.topic .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +.best_in_place_name { + max-width:130px; + float:left; +} + +.best_in_place_name input{ + max-width:130px; +} + +.topic-go-arrow { + width: 25px; + height: 25px; + float: right; +} + +.gray { + color: #999999; +} diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 70ace5f6..347d70f1 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -107,14 +107,6 @@ class MapsController < ApplicationController @map.attributes = params[:map] @map.save - if params[:outtopics] - @outtopics = params[:outtopics] - @outtopics.each do |topic| - @mapping = Mapping.where("map_id = ? AND topic_id = ?", @map.id, topic).first - @mapping.delete - end - end - respond_with(@user, location: map_path(@map)) do |format| end end diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index fb49ae15..5b95df3c 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -129,7 +129,32 @@ class TopicsController < ApplicationController # respond_with(@user, location: topic_url(@topic)) do |format| # end end - + + # GET mappings/:map_id/:topic_id/removefrommap + def removefrommap + @current = current_user + @mapping = Mapping.find_by_topic_id_and_map_id(params[:topic_id],params[:map_id]) + + @map = Map.find(params[:map_id]) + @topic = Topic.find(params[:topic_id]) + @mappings = @map.mappings.select{|m| + if m.category == "Synapse" + m.synapse.topic1 == @topic || m.synapse.topic2 == @topic + else + false + end + } + @mappings.each do |m| + m.delete + end + + @mapping.delete + + respond_to do |format| + format.js + end + end + # DELETE topics/:id def destroy @current = current_user diff --git a/app/views/main/console.html.erb b/app/views/main/console.html.erb index d3f8d28a..4fe2cf66 100644 --- a/app/views/main/console.html.erb +++ b/app/views/main/console.html.erb @@ -1,27 +1,27 @@ -
- <% if authenticated? %><% end %> - -
-
-
-
-
-
-
-
- <% if authenticated? %> - <%= render :partial => 'topics/new' %> - <%= render :partial => 'synapses/new' %> - <%= render :partial => 'maps/new' %> - <% end %> - - -<%= render :partial => 'find' %> -<%= render :partial => 'analyze' %> +
+ <% if authenticated? %><% end %> + +
+
+
+
+
+
+
+
+ <% if authenticated? %> + <%= render :partial => 'topics/new' %> + <%= render :partial => 'synapses/new' %> + <%= render :partial => 'maps/new' %> + <% end %> + + +<%= render :partial => 'find' %> +<%= render :partial => 'analyze' %> <%= render :partial => 'organize' %> \ No newline at end of file diff --git a/app/views/maps/edit.html.erb b/app/views/maps/edit.html.erb index 131617be..c1ead879 100644 --- a/app/views/maps/edit.html.erb +++ b/app/views/maps/edit.html.erb @@ -4,8 +4,6 @@ <%= form.text_field :name %> <%= form.text_area :desc, class: "description", :rows => 5 %> - - <%= select_tag "outtopics", options_from_collection_for_select(@outtopics, "id", "name"), { :multiple => true } %> <%= form.select :permission, options_for_select(['commons', 'public', 'private'], @map.permission) %> <%= form.submit "Update", class: "update" %> diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb index 90e0aa13..b545be79 100644 --- a/app/views/maps/show.html.erb +++ b/app/views/maps/show.html.erb @@ -22,15 +22,31 @@
-
+
-
-
+<% if authenticated? %> + <%= render :partial => 'newtopic' %> + <%= render :partial => 'newsynapse' %> +<% end %> +<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %> + <%= form.hidden_field :time, :value => Time.now.to_i %> + <%= form.hidden_field :ids, :value => 0 %> +<% end %> + + - -<% if authenticated? %> - <%= render :partial => 'newtopic' %> - <%= render :partial => 'newsynapse' %> -<% end %> -<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %> - <%= form.hidden_field :time, :value => Time.now.to_i %> - <%= form.hidden_field :ids, :value => 0 %> -<% end %> - \ No newline at end of file diff --git a/app/views/topics/destroy.js.erb b/app/views/topics/destroy.js.erb index da2a26ae..42d2677c 100644 --- a/app/views/topics/destroy.js.erb +++ b/app/views/topics/destroy.js.erb @@ -1 +1,17 @@ -$('#<%= dom_id(@topic) %>').fadeOut('slow'); \ No newline at end of file +if (Mconsole != null) { + var node = Mconsole.graph.getNode(<%= @topic.id %>); + node.setData('alpha', 0, 'end'); + node.eachAdjacency(function(adj) { + adj.setData('alpha', 0, 'end'); + }); + Mconsole.fx.animate({ + modes: ['node-property:alpha', + 'edge-property:alpha'], + duration: 1000 + }); + Mconsole.graph.removeNode(<%= @topic.id %>); + Mconsole.labels.disposeLabel(<%= @topic.id %>); +} +else { + $('#<%= dom_id(@topic) %>').fadeOut('slow'); +} \ No newline at end of file diff --git a/app/views/topics/removefrommap.js.erb b/app/views/topics/removefrommap.js.erb new file mode 100644 index 00000000..7241640d --- /dev/null +++ b/app/views/topics/removefrommap.js.erb @@ -0,0 +1,14 @@ +if (Mconsole != null) { + var node = Mconsole.graph.getNode(<%= @mapping.topic_id %>); + node.setData('alpha', 0, 'end'); + node.eachAdjacency(function(adj) { + adj.setData('alpha', 0, 'end'); + }); + Mconsole.fx.animate({ + modes: ['node-property:alpha', + 'edge-property:alpha'], + duration: 1000 + }); + Mconsole.graph.removeNode(<%= @mapping.topic_id %>); + Mconsole.labels.disposeLabel(<%= @mapping.topic_id %>); +} \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 6ae5eff9..98020f20 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,7 @@ ISSAD::Application.routes.draw do match 'maps/:id/savelayout', to: 'maps#savelayout', via: :put, as: :savelayout match 'maps/:id/realtime', to: 'maps#realtime', via: :get, as: :realtime + match 'mappings/:map_id/:topic_id/removefrommap', to: 'topics#removefrommap', via: :get, as: :removefrommap resource :session