diff --git a/app/assets/javascripts/Jit/loadgraphs.js b/app/assets/javascripts/Jit/loadgraphs.js index 8a5f03db..380acbb6 100644 --- a/app/assets/javascripts/Jit/loadgraphs.js +++ b/app/assets/javascripts/Jit/loadgraphs.js @@ -13,38 +13,6 @@ animate = !(iStuff || !nativeCanvasSupport); })(); -var imgArray = new Object(); - -imgArray['Group'] = new Image(); imgArray['Group'].src = '/assets/group.png'; -imgArray['Person'] = new Image(); imgArray['Person'].src = '/assets/person.png'; -imgArray['Bizarre'] = new Image(); imgArray['Bizarre'].src = '/assets/bizarre.png'; -imgArray['Catalyst'] = new Image(); imgArray['Catalyst'].src = '/assets/catalyst.png'; -imgArray['Closed'] = new Image(); imgArray['Closed'].src = '/assets/closed.png'; -imgArray['Experience'] = new Image(); imgArray['Experience'].src = '/assets/experience.png'; -imgArray['Future Dev'] = new Image(); imgArray['Future Dev'].src = '/assets/futuredev.png'; -imgArray['Idea'] = new Image(); imgArray['Idea'].src = '/assets/idea.png'; -imgArray['Implication'] = new Image(); imgArray['Implication'].src = '/assets/implication.png'; -imgArray['Insight'] = new Image(); imgArray['Insight'].src = '/assets/insight.png'; -imgArray['Intention'] = new Image(); imgArray['Intention'].src = '/assets/intention.png'; -imgArray['Knowledge'] = new Image(); imgArray['Knowledge'].src = '/assets/knowledge.png'; -imgArray['Location'] = new Image(); imgArray['Location'].src = '/assets/location.png'; -imgArray['Open Issue'] = new Image(); imgArray['Open Issue'].src = '/assets/openissue.png'; -imgArray['Opinion'] = new Image(); imgArray['Opinion'].src = '/assets/opinion.png'; -imgArray['Opportunity'] = new Image(); imgArray['Opportunity'].src = '/assets/opportunity.png'; -imgArray['Platform'] = new Image(); imgArray['Platform'].src = '/assets/platform.png'; -imgArray['Problem'] = new Image(); imgArray['Problem'].src = '/assets/problem.png'; -imgArray['Question'] = new Image(); imgArray['Question'].src = '/assets/question.png'; -imgArray['Reference'] = new Image(); imgArray['Reference'].src = '/assets/reference.png'; -imgArray['Requirement'] = new Image(); imgArray['Requirement'].src = '/assets/requirement.png'; -imgArray['Resource'] = new Image(); imgArray['Resource'].src = '/assets/resource.png'; -imgArray['Role'] = new Image(); imgArray['Role'].src = '/assets/role.png'; -imgArray['Task'] = new Image(); imgArray['Task'].src = '/assets/task.png'; -imgArray['Tool'] = new Image(); imgArray['Tool'].src = '/assets/tool.png'; -imgArray['Trajectory'] = new Image(); imgArray['Trajectory'].src = '/assets/trajectory.png'; -imgArray['Action'] = new Image(); imgArray['Action'].src = '/assets/action.png'; -imgArray['Activity'] = new Image(); imgArray['Activity'].src = '/assets/activity.png'; - - // init custom node type $jit.ForceDirected.Plot.NodeTypes.implement(nodeSettings); //implement an edge type diff --git a/app/assets/javascripts/Jit/onCreateLabelHandler.js b/app/assets/javascripts/Jit/onCreateLabelHandler.js index c67f6cf7..7284fa80 100644 --- a/app/assets/javascripts/Jit/onCreateLabelHandler.js +++ b/app/assets/javascripts/Jit/onCreateLabelHandler.js @@ -243,7 +243,7 @@ function generateLittleHTML(node) { //logged in, and owner of the topic, thus permission to delete littleHTML += ' \ \ '; } diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 66dc905b..b96ea14a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -226,9 +226,11 @@ function fetchRelatives(node) { url: "/topics/" + node.id + "?format=json", success: function(data) { if (gType == "centered") { + Mconsole.busy = true; Mconsole.op.sum(data, { type: 'fade', - duration: 500 + duration: 500, + hideLabels: false }); Mconsole.graph.eachNode(function (n) { n.eachAdjacency(function (a) { @@ -239,6 +241,7 @@ function fetchRelatives(node) { } }); }); + Mconsole.busy = false; } else { Mconsole.op.sum(data, { diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 6adbf863..c139866a 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -111,7 +111,6 @@ a { .new_session, .new_user, .new_map, -.edit_user, .edit_topic, .edit_synapse, .edit_map, @@ -129,6 +128,20 @@ a { border:2px solid #000; } +.edit_user{ + display: block; + width: 800px; + position:absolute; + left:50%; + top:0; + margin:50px 0 0 -420px; + background: url('bg.png'); + padding: 20px; + border-radius: 15px; + color: #000; + border:2px solid #000; +} + .onConsole .new_map { display:none; } diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss index 1efc835c..ff75b57e 100644 --- a/app/assets/stylesheets/users.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -1,3 +1,65 @@ // Place all the styles related to the users controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ + +.allMetacodes { + float:left; +} + +.allMetacodes span { + margin:4px 8px; + color:#67AF9F; +} + +.editMetacodes { + z-index:12; + width:auto; + color: #67AF9F; + padding:10px; + float:left; +} + +.editMetacodes ul { + display:block; +} + +.editMetacodes ul li { + clear:both; + list-style-type:none; + display:block; + padding:3px; +} + +.editMetacodes ul img { + width:40px; + height:40px; + float:left; +} + +.editMetacodes ul p { + float:left; + display: block; + margin: 0; + background: none; + padding: 10px 4px 2px 4px; +} + +.editMetacodes #filters-one { + float:left; +} + +.editMetacodes #filters-two { + float:left; +} + +.editMetacodes #filters-three { + float:left; +} + +.editMetacodes #filters-four { + float:left; +} + +.editMetacodes li.toggledOff { + opacity: 0.4; +} \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5ca2cf36..d80ce66d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -64,6 +64,9 @@ class UsersController < ApplicationController @user = current_user @user.attributes = params[:user] + @m = params[:metacodes][:value] + @user.settings.metacodes=@m.split(',') + @user.save respond_with(@user, location: user_url(@user)) do |format| diff --git a/app/models/metacode.rb b/app/models/metacode.rb index c181a19f..0de248be 100644 --- a/app/models/metacode.rb +++ b/app/models/metacode.rb @@ -2,4 +2,9 @@ class Metacode < ActiveRecord::Base has_many :topics + def hasSelected(user) + return true if user.settings.metacodes.include? self.id.to_s + return false + end + end diff --git a/app/models/user.rb b/app/models/user.rb index 1e4f824c..3af99561 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -15,6 +15,8 @@ has_many :mappings configuration.merge_validates_length_of_email_field_options unless: Proc.new { |user| user.email.blank? and user.authed? } end + serialize :settings, UserPreference + validates :password, :presence => true, :length => { :maximum => 20, @@ -27,5 +29,18 @@ has_many :mappings :on => :update validates :joinedwithcode, :presence => true, :inclusion => { :in => User.all.map(&:code), :message => "%{value} is not a valid code" }, :on => :create - + + def settings + # make sure we always return a UserPreference instance + if read_attribute(:settings).nil? + write_attribute :settings, UserPreference.new + read_attribute :settings + else + read_attribute :settings + end + end + + def settings=(val) + write_attribute :settings, val + end end diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb new file mode 100644 index 00000000..9c2732a4 --- /dev/null +++ b/app/models/user_preference.rb @@ -0,0 +1,11 @@ +class UserPreference + attr_accessor :metacodes + + def initialize + array = [] + Metacode.all.each do |m| + array.push(m.id.to_s) + end + @metacodes = array + end +end \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 03d66914..c9ae28de 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -20,6 +20,13 @@ var username = null; <% end %> + <%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %> diff --git a/app/views/maps/_newtopic.html.erb b/app/views/maps/_newtopic.html.erb index 075a9321..c1a8d1ab 100644 --- a/app/views/maps/_newtopic.html.erb +++ b/app/views/maps/_newtopic.html.erb @@ -4,7 +4,13 @@ #%>
<%= @m[$i].name.downcase %>
+ +<%= @m[$i].name.downcase %>
+ +<%= @m[$i].name.downcase %>
+ +<%= @m[$i].name.downcase %>
+ +