From 2138aa89f393ee6879bb096f0e8828baa626a04f Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 22:26:12 -0400 Subject: [PATCH] closes #368. ability to add in metacode colors --- app/assets/stylesheets/application.css | 3 + app/assets/stylesheets/base.css | 2 +- app/views/layouts/application.html.erb | 1 + app/views/metacodes/_form.html.erb | 5 + app/views/metacodes/index.html.erb | 8 + app/views/shared/_metacodeBgColors.html.erb | 9 + .../20140930013020_add_color_to_metacodes.rb | 5 + .../20140930013020_add_color_to_metacodes.rb~ | 5 + db/schema.rb | 267 +++++++++--------- metacode_backgrounds.css | 120 ++++++++ 10 files changed, 291 insertions(+), 134 deletions(-) create mode 100644 app/views/shared/_metacodeBgColors.html.erb create mode 100644 db/migrate/20140930013020_add_color_to_metacodes.rb create mode 100644 db/migrate/20140930013020_add_color_to_metacodes.rb~ create mode 100644 metacode_backgrounds.css diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index cebb5434..5bd28000 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2151,6 +2151,9 @@ float: left; .blackBox td.iconURL { max-width: 415px; word-wrap: break-word; +} +.blackBox td.iconColor { + } .blackBox .field { margin: 15px 0 5px; diff --git a/app/assets/stylesheets/base.css b/app/assets/stylesheets/base.css index cfa49d44..3725297e 100644 --- a/app/assets/stylesheets/base.css +++ b/app/assets/stylesheets/base.css @@ -292,7 +292,7 @@ cursor: pointer; display: none; width: 90%; padding: 13px 0 9px 10%; - background-color: #64BC61; + background-color: #E0E0E0; color: #424242; } .permission.canEdit .metacodeTitle { diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9e17a43d..91e9693b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -77,6 +77,7 @@ <%= render :partial => 'layouts/lightboxes' %> <%= render :partial => 'layouts/templates' %> +<%= render :partial => 'shared/metacodeBgColors' %> diff --git a/app/views/metacodes/_form.html.erb b/app/views/metacodes/_form.html.erb index de815bbc..ee19048b 100644 --- a/app/views/metacodes/_form.html.erb +++ b/app/views/metacodes/_form.html.erb @@ -21,6 +21,11 @@ <%= f.text_field :icon %>
+
+ <%= f.label :color, "Color (hex with # sign)" %> + <%= f.text_field :color %> +
+
<%= link_to 'Cancel', metacodes_path, { :class => 'button', 'data-bypass' => 'true' } %> <%= f.submit :class => 'add' %> diff --git a/app/views/metacodes/index.html.erb b/app/views/metacodes/index.html.erb index 36901d56..c99634d4 100644 --- a/app/views/metacodes/index.html.erb +++ b/app/views/metacodes/index.html.erb @@ -6,6 +6,7 @@ Name Icon + Color @@ -14,6 +15,13 @@ <%= metacode.name %> <%= metacode.icon %> + <% if metacode.color %> + + <%= metacode.color %> + + <% else %> + + <% end %> <%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %> diff --git a/app/views/shared/_metacodeBgColors.html.erb b/app/views/shared/_metacodeBgColors.html.erb new file mode 100644 index 00000000..a1aa030c --- /dev/null +++ b/app/views/shared/_metacodeBgColors.html.erb @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/db/migrate/20140930013020_add_color_to_metacodes.rb b/db/migrate/20140930013020_add_color_to_metacodes.rb new file mode 100644 index 00000000..59c8f89f --- /dev/null +++ b/db/migrate/20140930013020_add_color_to_metacodes.rb @@ -0,0 +1,5 @@ +class AddColorToMetacodes < ActiveRecord::Migration + def change + add_column :metacodes, :color, :string + end +end diff --git a/db/migrate/20140930013020_add_color_to_metacodes.rb~ b/db/migrate/20140930013020_add_color_to_metacodes.rb~ new file mode 100644 index 00000000..59c8f89f --- /dev/null +++ b/db/migrate/20140930013020_add_color_to_metacodes.rb~ @@ -0,0 +1,5 @@ +class AddColorToMetacodes < ActiveRecord::Migration + def change + add_column :metacodes, :color, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 50334775..113dba8a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,133 +1,134 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20140815162253) do - - create_table "in_metacode_sets", :force => true do |t| - t.integer "metacode_id" - t.integer "metacode_set_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" - add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" - - create_table "mappings", :force => true do |t| - t.text "category" - t.integer "xloc" - t.integer "yloc" - t.integer "topic_id" - t.integer "synapse_id" - t.integer "map_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "maps", :force => true do |t| - t.text "name" - t.boolean "arranged" - t.text "desc" - t.text "permission" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "featured" - t.string "screenshot_file_name" - t.string "screenshot_content_type" - t.integer "screenshot_file_size" - t.datetime "screenshot_updated_at" - end - - create_table "metacode_sets", :force => true do |t| - t.string "name" - t.text "desc" - t.integer "user_id" - t.boolean "mapperContributed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" - - create_table "metacodes", :force => true do |t| - t.text "name" - t.string "icon" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "synapses", :force => true do |t| - t.text "desc" - t.text "category" - t.text "weight" - t.text "permission" - t.integer "node1_id" - t.integer "node2_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "topics", :force => true do |t| - t.text "name" - t.text "desc" - t.text "link" - t.text "permission" - t.integer "user_id" - t.integer "metacode_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - t.string "audio_file_name" - t.string "audio_content_type" - t.integer "audio_file_size" - t.datetime "audio_updated_at" - end - - create_table "users", :force => true do |t| - t.string "name" - t.string "email" - t.text "settings" - t.string "code", :limit => 8 - t.string "joinedwithcode", :limit => 8 - t.string "crypted_password" - t.string "password_salt" - t.string "persistence_token" - t.string "perishable_token" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "encrypted_password", :limit => 128, :default => "" - t.string "remember_token" - t.datetime "remember_created_at" - t.string "reset_password_token" - t.datetime "last_sign_in_at" - t.string "last_sign_in_ip" - t.integer "sign_in_count", :default => 0 - t.datetime "current_sign_in_at" - t.string "current_sign_in_ip" - t.datetime "reset_password_sent_at" - t.boolean "admin" - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - end - - add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20140930013020) do + + create_table "in_metacode_sets", :force => true do |t| + t.integer "metacode_id" + t.integer "metacode_set_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" + add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" + + create_table "mappings", :force => true do |t| + t.text "category" + t.integer "xloc" + t.integer "yloc" + t.integer "topic_id" + t.integer "synapse_id" + t.integer "map_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "maps", :force => true do |t| + t.text "name" + t.boolean "arranged" + t.text "desc" + t.text "permission" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "featured" + t.string "screenshot_file_name" + t.string "screenshot_content_type" + t.integer "screenshot_file_size" + t.datetime "screenshot_updated_at" + end + + create_table "metacode_sets", :force => true do |t| + t.string "name" + t.text "desc" + t.integer "user_id" + t.boolean "mapperContributed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" + + create_table "metacodes", :force => true do |t| + t.text "name" + t.string "icon" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "color" + end + + create_table "synapses", :force => true do |t| + t.text "desc" + t.text "category" + t.text "weight" + t.text "permission" + t.integer "node1_id" + t.integer "node2_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "topics", :force => true do |t| + t.text "name" + t.text "desc" + t.text "link" + t.text "permission" + t.integer "user_id" + t.integer "metacode_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + t.string "audio_file_name" + t.string "audio_content_type" + t.integer "audio_file_size" + t.datetime "audio_updated_at" + end + + create_table "users", :force => true do |t| + t.string "name" + t.string "email" + t.text "settings" + t.string "code", :limit => 8 + t.string "joinedwithcode", :limit => 8 + t.string "crypted_password" + t.string "password_salt" + t.string "persistence_token" + t.string "perishable_token" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "encrypted_password", :limit => 128, :default => "" + t.string "remember_token" + t.datetime "remember_created_at" + t.string "reset_password_token" + t.datetime "last_sign_in_at" + t.string "last_sign_in_ip" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.string "current_sign_in_ip" + t.datetime "reset_password_sent_at" + t.boolean "admin" + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + end + + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + +end diff --git a/metacode_backgrounds.css b/metacode_backgrounds.css new file mode 100644 index 00000000..adf69d4e --- /dev/null +++ b/metacode_backgrounds.css @@ -0,0 +1,120 @@ +.mbgAction { + background-color: #bd6c85 !important; +} +.mbgActivity { + background-color: #6ebf65 !important; +} +.mbgArgument { + background-color: #7FAEFD !important; +} +.mbgBizarre { + background-color: #bdb25e !important; +} +.mbgCatalyst { + background-color: #EF8964 !important; +} +.mbgClosed { + background-color: #ABB49F !important; +} +.mbgCon { + background-color: #CF7C74 !important; +} +.mbgDecision { + background-color: #cca866 !important; +} +.mbgExample { + background-color: #598559 !important; +} +.mbgExperience { + background-color: #BE995F !important; +} +.mbgForesight { + background-color: #b0b0b0 !important; +} +.mbgFutureDev { + background-color: #25A17F !important; +} +.mbgGoodPractice { + background-color: #BD9E86 !important; +} +.mbgGroup { + background-color: #7076BC !important; +} +.mbgIdea { + background-color: #c4bc5e !important; +} +.mbgImplication { + background-color: #83DECA !important; +} +.mbgInsight { + background-color: #B074AD !important; +} +.mbgIntention { + background-color: #baeaff !important; +} +.mbgKnowledge { + background-color: #60acf7 !important; +} +.mbgList { + background-color: #B7A499 !important; +} +.mbgLocation { + background-color: #abd9a7 !important; +} +.mbgMovieMap { + background-color: #a5a0de !important; +} +.mbgNote { + background-color: #a389a1 !important; +} +.mbgOpenIssue { + background-color: #9bbf71 !important; +} +.mbgOpinion { + background-color: #54a19d !important; +} +.mbgOpportunity { + background-color: #889F64 !important; +} +.mbgPerson { + background-color: #de925f !important; +} +.mbgPlatform { + background-color: #21C8FE !important; +} +.mbgPro { + background-color: #89b879 !important; +} +.mbgProblem { + background-color: #99cfc4 !important; +} +.mbgQuestion { + background-color: #709899 !important; +} +.mbgReference { + background-color: #A7A7A7 !important; +} +.mbgRequirement { + background-color: #d2a7d4 !important; +} +.mbgResearch { + background-color: #CD8E89 !important; +} +.mbgResource { + background-color: #c98c63 !important; +} +.mbgRole { + background-color: #a8595d !important; +} +.mbgTask { + background-color: #2f89ba !important; +} +.mbgTool { + background-color: #828282 !important; +} +.mbgTrajectory { + background-color: #b3953d !important; +} +.mbgWildcard { + background-color: #73c7de !important; +} \ No newline at end of file