From 48dc11b53d8a66a9e3e55e03b3c4a77cd8b765ca Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sat, 17 May 2014 14:57:03 -0400 Subject: [PATCH] added ability for an admin to add metacodes and metacode sets --- Gemfile.lock | 57 ++++----- app/assets/images/{ => icons}/action.png | Bin app/assets/images/{ => icons}/activity.png | Bin app/assets/images/{ => icons}/argument.png | Bin app/assets/images/{ => icons}/bizarre.png | Bin app/assets/images/{ => icons}/catalyst.png | Bin app/assets/images/{ => icons}/closed.png | Bin app/assets/images/{ => icons}/con_icon.png | Bin app/assets/images/{ => icons}/decision.png | Bin app/assets/images/{ => icons}/example.png | Bin app/assets/images/{ => icons}/experience.png | Bin app/assets/images/{ => icons}/foresight.png | Bin app/assets/images/{ => icons}/futuredev.png | Bin .../images/{ => icons}/goodpractice.png | Bin app/assets/images/{ => icons}/group.png | Bin app/assets/images/{ => icons}/idea.png | Bin app/assets/images/{ => icons}/implication.png | Bin app/assets/images/{ => icons}/insight.png | Bin app/assets/images/{ => icons}/intention.png | Bin app/assets/images/{ => icons}/knowledge.png | Bin app/assets/images/{ => icons}/list.png | Bin app/assets/images/{ => icons}/location.png | Bin app/assets/images/{ => icons}/moviemap.png | Bin app/assets/images/{ => icons}/note.png | Bin app/assets/images/{ => icons}/openissue.png | Bin app/assets/images/{ => icons}/opinion.png | Bin app/assets/images/{ => icons}/opportunity.png | Bin app/assets/images/{ => icons}/person.png | Bin app/assets/images/{ => icons}/platform.png | Bin app/assets/images/{ => icons}/pro.png | Bin app/assets/images/{ => icons}/problem.png | Bin app/assets/images/{ => icons}/question.png | Bin app/assets/images/{ => icons}/reference.png | Bin app/assets/images/{ => icons}/requirement.png | Bin app/assets/images/{ => icons}/research.png | Bin app/assets/images/{ => icons}/resource.png | Bin app/assets/images/{ => icons}/role.png | Bin app/assets/images/{ => icons}/task.png | Bin app/assets/images/{ => icons}/tool.png | Bin app/assets/images/{ => icons}/trajectory.png | Bin app/assets/images/{ => icons}/wildcard.png | Bin app/assets/images/junto.png | Bin 12099 -> 0 bytes .../javascripts/in_metacode_sets.js.coffee | 3 + .../javascripts/metacode_sets.js.coffee | 3 + app/assets/stylesheets/application.css | 117 +++++++++++++++++ .../stylesheets/in_metacode_sets.css.scss | 3 + app/assets/stylesheets/metacode_sets.css.scss | 3 + app/controllers/application_controller.rb | 12 ++ .../in_metacode_sets_controller.rb | 86 +++++++++++++ app/controllers/metacode_sets_controller.rb | 119 ++++++++++++++++++ app/controllers/metacodes_controller.rb | 89 +++++++++++++ app/helpers/in_metacode_sets_helper.rb | 2 + app/helpers/metacode_sets_helper.rb | 2 + app/helpers/metacodes_helper.rb | 2 + app/models/in_metacode_set.rb | 5 + app/models/metacode.rb | 9 +- app/models/metacode_set.rb | 6 + app/views/admin/_adminpanel.html.erb | 6 + app/views/in_metacode_sets/_form.html.erb | 25 ++++ app/views/in_metacode_sets/edit.html.erb | 6 + app/views/in_metacode_sets/index.html.erb | 25 ++++ app/views/in_metacode_sets/new.html.erb | 5 + app/views/in_metacode_sets/show.html.erb | 15 +++ app/views/layouts/_account.html.erb | 3 + app/views/layouts/application.html.erb | 2 +- app/views/main/_filterbymetacode.html.erb | 2 +- app/views/main/_metacodeoptions.html.erb | 2 +- app/views/maps/_newtopic.html.erb | 2 +- app/views/metacode_sets/_form.html.erb | 81 ++++++++++++ app/views/metacode_sets/edit.html.erb | 58 +++++++++ app/views/metacode_sets/index.html.erb | 41 ++++++ app/views/metacode_sets/new.html.erb | 58 +++++++++ app/views/metacode_sets/show.html.erb | 19 +++ app/views/metacodes/_form.html.erb | 28 +++++ app/views/metacodes/edit.html.erb | 7 ++ app/views/metacodes/index.html.erb | 31 +++++ app/views/metacodes/new.html.erb | 7 ++ app/views/metacodes/show.html.erb | 19 +++ app/views/topics/_new.html.erb | 2 +- app/views/users/edit.html.erb | 8 +- config/initializers/devise.rb | 6 +- config/routes.rb | 4 + .../20140517115027_create_metacode_sets.rb | 13 ++ .../20140517115841_create_in_metacode_sets.rb | 12 ++ db/schema.rb | 23 +++- test/fixtures/in_metacode_sets.yml | 9 ++ test/fixtures/metacode_sets.yml | 13 ++ test/fixtures/metacodes.yml | 80 ++++++------ .../in_metacode_sets_controller_test.rb | 49 ++++++++ .../metacode_sets_controller_test.rb | 49 ++++++++ test/functional/metacodes_controller_test.rb | 49 ++++++++ .../helpers/in_metacode_sets_helper_test.rb | 4 + .../unit/helpers/metacode_sets_helper_test.rb | 4 + test/unit/helpers/metacodes_helper_test.rb | 4 + test/unit/in_metacode_set_test.rb | 7 ++ test/unit/metacode_set_test.rb | 7 ++ 96 files changed, 1223 insertions(+), 80 deletions(-) rename app/assets/images/{ => icons}/action.png (100%) rename app/assets/images/{ => icons}/activity.png (100%) rename app/assets/images/{ => icons}/argument.png (100%) rename app/assets/images/{ => icons}/bizarre.png (100%) rename app/assets/images/{ => icons}/catalyst.png (100%) rename app/assets/images/{ => icons}/closed.png (100%) rename app/assets/images/{ => icons}/con_icon.png (100%) rename app/assets/images/{ => icons}/decision.png (100%) rename app/assets/images/{ => icons}/example.png (100%) rename app/assets/images/{ => icons}/experience.png (100%) rename app/assets/images/{ => icons}/foresight.png (100%) rename app/assets/images/{ => icons}/futuredev.png (100%) rename app/assets/images/{ => icons}/goodpractice.png (100%) rename app/assets/images/{ => icons}/group.png (100%) rename app/assets/images/{ => icons}/idea.png (100%) rename app/assets/images/{ => icons}/implication.png (100%) rename app/assets/images/{ => icons}/insight.png (100%) rename app/assets/images/{ => icons}/intention.png (100%) rename app/assets/images/{ => icons}/knowledge.png (100%) rename app/assets/images/{ => icons}/list.png (100%) rename app/assets/images/{ => icons}/location.png (100%) rename app/assets/images/{ => icons}/moviemap.png (100%) rename app/assets/images/{ => icons}/note.png (100%) rename app/assets/images/{ => icons}/openissue.png (100%) rename app/assets/images/{ => icons}/opinion.png (100%) rename app/assets/images/{ => icons}/opportunity.png (100%) rename app/assets/images/{ => icons}/person.png (100%) rename app/assets/images/{ => icons}/platform.png (100%) rename app/assets/images/{ => icons}/pro.png (100%) rename app/assets/images/{ => icons}/problem.png (100%) rename app/assets/images/{ => icons}/question.png (100%) rename app/assets/images/{ => icons}/reference.png (100%) rename app/assets/images/{ => icons}/requirement.png (100%) rename app/assets/images/{ => icons}/research.png (100%) rename app/assets/images/{ => icons}/resource.png (100%) rename app/assets/images/{ => icons}/role.png (100%) rename app/assets/images/{ => icons}/task.png (100%) rename app/assets/images/{ => icons}/tool.png (100%) rename app/assets/images/{ => icons}/trajectory.png (100%) rename app/assets/images/{ => icons}/wildcard.png (100%) delete mode 100644 app/assets/images/junto.png create mode 100644 app/assets/javascripts/in_metacode_sets.js.coffee create mode 100644 app/assets/javascripts/metacode_sets.js.coffee create mode 100644 app/assets/stylesheets/in_metacode_sets.css.scss create mode 100644 app/assets/stylesheets/metacode_sets.css.scss create mode 100644 app/controllers/in_metacode_sets_controller.rb create mode 100644 app/controllers/metacode_sets_controller.rb create mode 100644 app/controllers/metacodes_controller.rb create mode 100644 app/helpers/in_metacode_sets_helper.rb create mode 100644 app/helpers/metacode_sets_helper.rb create mode 100644 app/helpers/metacodes_helper.rb create mode 100644 app/models/in_metacode_set.rb create mode 100644 app/models/metacode_set.rb create mode 100644 app/views/admin/_adminpanel.html.erb create mode 100644 app/views/in_metacode_sets/_form.html.erb create mode 100644 app/views/in_metacode_sets/edit.html.erb create mode 100644 app/views/in_metacode_sets/index.html.erb create mode 100644 app/views/in_metacode_sets/new.html.erb create mode 100644 app/views/in_metacode_sets/show.html.erb create mode 100644 app/views/metacode_sets/_form.html.erb create mode 100644 app/views/metacode_sets/edit.html.erb create mode 100644 app/views/metacode_sets/index.html.erb create mode 100644 app/views/metacode_sets/new.html.erb create mode 100644 app/views/metacode_sets/show.html.erb create mode 100644 app/views/metacodes/_form.html.erb create mode 100644 app/views/metacodes/edit.html.erb create mode 100644 app/views/metacodes/index.html.erb create mode 100644 app/views/metacodes/new.html.erb create mode 100644 app/views/metacodes/show.html.erb create mode 100644 db/migrate/20140517115027_create_metacode_sets.rb create mode 100644 db/migrate/20140517115841_create_in_metacode_sets.rb create mode 100644 test/fixtures/in_metacode_sets.yml create mode 100644 test/fixtures/metacode_sets.yml create mode 100644 test/functional/in_metacode_sets_controller_test.rb create mode 100644 test/functional/metacode_sets_controller_test.rb create mode 100644 test/functional/metacodes_controller_test.rb create mode 100644 test/unit/helpers/in_metacode_sets_helper_test.rb create mode 100644 test/unit/helpers/metacode_sets_helper_test.rb create mode 100644 test/unit/helpers/metacodes_helper_test.rb create mode 100644 test/unit/in_metacode_set_test.rb create mode 100644 test/unit/metacode_set_test.rb diff --git a/Gemfile.lock b/Gemfile.lock index efec0f57..3346fa26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,31 +29,31 @@ GEM i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) arel (3.0.3) - bcrypt-ruby (3.0.1) - bcrypt-ruby (3.0.1-x86-mingw32) - best_in_place (2.0.2) + bcrypt (3.1.7) + bcrypt (3.1.7-x86-mingw32) + best_in_place (2.1.0) jquery-rails rails (~> 3.1) builder (3.0.4) - cancan (1.6.7) + cancan (1.6.10) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.3.3) - devise (2.2.3) - bcrypt-ruby (~> 3.0) + coffee-script-source (1.7.0) + devise (3.2.4) + bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (~> 3.1) - warden (~> 1.2.1) + railties (>= 3.2.6, < 5) + thread_safe (~> 0.1) + warden (~> 1.2.3) erubis (2.7.0) - execjs (1.4.0) - multi_json (~> 1.0) - formtastic (2.0.2) - rails (~> 3.0) - formula (0.3.3) + execjs (2.0.2) + formtastic (2.2.1) + actionpack (>= 3.0) + formula (1.0.1) rails (> 3.0.0) hike (1.2.3) i18n (0.6.9) @@ -68,10 +68,10 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - multi_json (1.9.3) - orm_adapter (0.4.0) - pg (0.12.2) - pg (0.12.2-x86-mingw32) + multi_json (1.10.0) + orm_adapter (0.5.0) + pg (0.17.1) + pg (0.17.1-x86-mingw32) polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) @@ -88,8 +88,8 @@ GEM activesupport (= 3.2.17) bundler (~> 1.0) railties (= 3.2.17) - rails3-jquery-autocomplete (1.0.10) - rails (~> 3.0) + rails3-jquery-autocomplete (1.0.14) + rails (>= 3.0) railties (3.2.17) actionpack (= 3.2.17) activesupport (= 3.2.17) @@ -97,13 +97,13 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.3.1) + rake (10.3.2) rdoc (3.12.2) json (~> 1.4) - redis (2.2.2) - sass (3.2.7) - sass-rails (3.2.3) - railties (~> 3.2.0.beta) + redis (3.0.7) + sass (3.3.7) + sass-rails (3.2.6) + railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) sprockets (2.2.2) @@ -112,15 +112,16 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) thor (0.19.1) + thread_safe (0.3.3) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (0.3.39) - uglifier (1.3.0) + uglifier (2.5.0) execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) - warden (1.2.1) + json (>= 1.8.0) + warden (1.2.3) rack (>= 1.0) PLATFORMS diff --git a/app/assets/images/action.png b/app/assets/images/icons/action.png similarity index 100% rename from app/assets/images/action.png rename to app/assets/images/icons/action.png diff --git a/app/assets/images/activity.png b/app/assets/images/icons/activity.png similarity index 100% rename from app/assets/images/activity.png rename to app/assets/images/icons/activity.png diff --git a/app/assets/images/argument.png b/app/assets/images/icons/argument.png similarity index 100% rename from app/assets/images/argument.png rename to app/assets/images/icons/argument.png diff --git a/app/assets/images/bizarre.png b/app/assets/images/icons/bizarre.png similarity index 100% rename from app/assets/images/bizarre.png rename to app/assets/images/icons/bizarre.png diff --git a/app/assets/images/catalyst.png b/app/assets/images/icons/catalyst.png similarity index 100% rename from app/assets/images/catalyst.png rename to app/assets/images/icons/catalyst.png diff --git a/app/assets/images/closed.png b/app/assets/images/icons/closed.png similarity index 100% rename from app/assets/images/closed.png rename to app/assets/images/icons/closed.png diff --git a/app/assets/images/con_icon.png b/app/assets/images/icons/con_icon.png similarity index 100% rename from app/assets/images/con_icon.png rename to app/assets/images/icons/con_icon.png diff --git a/app/assets/images/decision.png b/app/assets/images/icons/decision.png similarity index 100% rename from app/assets/images/decision.png rename to app/assets/images/icons/decision.png diff --git a/app/assets/images/example.png b/app/assets/images/icons/example.png similarity index 100% rename from app/assets/images/example.png rename to app/assets/images/icons/example.png diff --git a/app/assets/images/experience.png b/app/assets/images/icons/experience.png similarity index 100% rename from app/assets/images/experience.png rename to app/assets/images/icons/experience.png diff --git a/app/assets/images/foresight.png b/app/assets/images/icons/foresight.png similarity index 100% rename from app/assets/images/foresight.png rename to app/assets/images/icons/foresight.png diff --git a/app/assets/images/futuredev.png b/app/assets/images/icons/futuredev.png similarity index 100% rename from app/assets/images/futuredev.png rename to app/assets/images/icons/futuredev.png diff --git a/app/assets/images/goodpractice.png b/app/assets/images/icons/goodpractice.png similarity index 100% rename from app/assets/images/goodpractice.png rename to app/assets/images/icons/goodpractice.png diff --git a/app/assets/images/group.png b/app/assets/images/icons/group.png similarity index 100% rename from app/assets/images/group.png rename to app/assets/images/icons/group.png diff --git a/app/assets/images/idea.png b/app/assets/images/icons/idea.png similarity index 100% rename from app/assets/images/idea.png rename to app/assets/images/icons/idea.png diff --git a/app/assets/images/implication.png b/app/assets/images/icons/implication.png similarity index 100% rename from app/assets/images/implication.png rename to app/assets/images/icons/implication.png diff --git a/app/assets/images/insight.png b/app/assets/images/icons/insight.png similarity index 100% rename from app/assets/images/insight.png rename to app/assets/images/icons/insight.png diff --git a/app/assets/images/intention.png b/app/assets/images/icons/intention.png similarity index 100% rename from app/assets/images/intention.png rename to app/assets/images/icons/intention.png diff --git a/app/assets/images/knowledge.png b/app/assets/images/icons/knowledge.png similarity index 100% rename from app/assets/images/knowledge.png rename to app/assets/images/icons/knowledge.png diff --git a/app/assets/images/list.png b/app/assets/images/icons/list.png similarity index 100% rename from app/assets/images/list.png rename to app/assets/images/icons/list.png diff --git a/app/assets/images/location.png b/app/assets/images/icons/location.png similarity index 100% rename from app/assets/images/location.png rename to app/assets/images/icons/location.png diff --git a/app/assets/images/moviemap.png b/app/assets/images/icons/moviemap.png similarity index 100% rename from app/assets/images/moviemap.png rename to app/assets/images/icons/moviemap.png diff --git a/app/assets/images/note.png b/app/assets/images/icons/note.png similarity index 100% rename from app/assets/images/note.png rename to app/assets/images/icons/note.png diff --git a/app/assets/images/openissue.png b/app/assets/images/icons/openissue.png similarity index 100% rename from app/assets/images/openissue.png rename to app/assets/images/icons/openissue.png diff --git a/app/assets/images/opinion.png b/app/assets/images/icons/opinion.png similarity index 100% rename from app/assets/images/opinion.png rename to app/assets/images/icons/opinion.png diff --git a/app/assets/images/opportunity.png b/app/assets/images/icons/opportunity.png similarity index 100% rename from app/assets/images/opportunity.png rename to app/assets/images/icons/opportunity.png diff --git a/app/assets/images/person.png b/app/assets/images/icons/person.png similarity index 100% rename from app/assets/images/person.png rename to app/assets/images/icons/person.png diff --git a/app/assets/images/platform.png b/app/assets/images/icons/platform.png similarity index 100% rename from app/assets/images/platform.png rename to app/assets/images/icons/platform.png diff --git a/app/assets/images/pro.png b/app/assets/images/icons/pro.png similarity index 100% rename from app/assets/images/pro.png rename to app/assets/images/icons/pro.png diff --git a/app/assets/images/problem.png b/app/assets/images/icons/problem.png similarity index 100% rename from app/assets/images/problem.png rename to app/assets/images/icons/problem.png diff --git a/app/assets/images/question.png b/app/assets/images/icons/question.png similarity index 100% rename from app/assets/images/question.png rename to app/assets/images/icons/question.png diff --git a/app/assets/images/reference.png b/app/assets/images/icons/reference.png similarity index 100% rename from app/assets/images/reference.png rename to app/assets/images/icons/reference.png diff --git a/app/assets/images/requirement.png b/app/assets/images/icons/requirement.png similarity index 100% rename from app/assets/images/requirement.png rename to app/assets/images/icons/requirement.png diff --git a/app/assets/images/research.png b/app/assets/images/icons/research.png similarity index 100% rename from app/assets/images/research.png rename to app/assets/images/icons/research.png diff --git a/app/assets/images/resource.png b/app/assets/images/icons/resource.png similarity index 100% rename from app/assets/images/resource.png rename to app/assets/images/icons/resource.png diff --git a/app/assets/images/role.png b/app/assets/images/icons/role.png similarity index 100% rename from app/assets/images/role.png rename to app/assets/images/icons/role.png diff --git a/app/assets/images/task.png b/app/assets/images/icons/task.png similarity index 100% rename from app/assets/images/task.png rename to app/assets/images/icons/task.png diff --git a/app/assets/images/tool.png b/app/assets/images/icons/tool.png similarity index 100% rename from app/assets/images/tool.png rename to app/assets/images/icons/tool.png diff --git a/app/assets/images/trajectory.png b/app/assets/images/icons/trajectory.png similarity index 100% rename from app/assets/images/trajectory.png rename to app/assets/images/icons/trajectory.png diff --git a/app/assets/images/wildcard.png b/app/assets/images/icons/wildcard.png similarity index 100% rename from app/assets/images/wildcard.png rename to app/assets/images/icons/wildcard.png diff --git a/app/assets/images/junto.png b/app/assets/images/junto.png deleted file mode 100644 index 2dd623b514efe7a4a787160460b7fbf33a6219e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12099 zcmW++WmFv95}d_Z+=B&ow-DSdxVsZv0|^d`LvRTW!QCB#yK8WF3lJLs8~C>Ik{RpIg`stNRT^!ak8|r{|o>gD_QDR8tTXRLU$WC;_~5;BzY$_ zJS1{8@kj`6JS`&yGUlgniri&9)gCM#X`I#BLkCH+Lp3FO*7CviHTANAfW>6s^K9F0Gu~qGE7C~0R*Q3xYAeJ zf|pEHn1_r|q|)jHTdDb^0`!qsToARjS>Mx7$`LT(elUeGO&4YD^-Lq=4B*Dtx*i9B zoOnEFwAU{lljv2GlOJN5(2ZG6x)9zd&CGUR_ovF8MFC*j&2Q$FnXR4(B7gvKc+I0Z zhqE?9$@zL0X<3IM+6d$vuV`O8|A&oKZd~i~^8Vi5(x-lL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iy@RG2bO%}>X-@A{EGU}vl(>b4cc|lY9D51G>edA6Z)XX7~b9$mx3!O9zA=p zDot|gsS!;`3_4;%mCrmAS|G!VM7)|jrevvnG~y_Sk^Bi@_hs* zDWHB^md6GQJ_3ldsFOOq_{5`)2f%pMsk65v-ojCJNpe%CiA`r!GfSb1@#KbeDmZj8 zf-rSL(NrAb1$+>_Gb^`3aS div.blackBox { +width: 700px; +margin: 0 auto; +padding: 20px 0 20px 20px; +background: rgba(0,0,0,0.4); +color: white; +height: 100%; +overflow: hidden; +position: relative; +} + +.blackBox .metacodeSetsDescription { + width: 340px; +} + +.blackBox tr:nth-child(odd) { + background: rgba(0, 0, 0, 0.2); +} +.blackBox tr:nth-child(even) { + background: rgba(0, 0, 0, 0.3); +} + +.blackBox th, .blackBox td { + padding:10px; +} + +.blackBox .field { + margin: 15px 0 5px; +} + +.blackBox label { + float:left; + width: 100px; + margin-right: 15px; +} + +.blackBox input[type="text"] { +width: 336px; +height: 32px; +font-size: 15px; +direction: ltr; +-webkit-appearance: none; +appearance: none; +display: inline-block; +margin: 0; +padding: 0 8px; +background: #fff; +border: 1px solid #d9d9d9; +border-top: 1px solid #c0c0c0; +-webkit-box-sizing: border-box; +-moz-box-sizing: border-box; +box-sizing: border-box; +-webkit-border-radius: 1px; +-moz-border-radius: 1px; +border-radius: 1px; +font: -webkit-small-control; +color: initial; +letter-spacing: normal; +word-spacing: normal; +text-transform: none; +text-indent: 0px; +text-shadow: none; +display: inline-block; +text-align: start; +font-family:arial; +} +.blackBox input[type="text"]:hover, .blackBox textarea:hover { + border: 1px solid #b9b9b9; + border-top: 1px solid #a0a0a0; + -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); + box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); +} + +.blackBox textarea { + padding:8px; + border: 1px solid #d9d9d9; + border-top: 1px solid #c0c0c0; + resize:none; + font: -webkit-small-control; + letter-spacing: normal; + word-spacing: normal; + text-transform: none; + text-indent: 0px; + text-shadow: none; + text-align: start; + font-family:arial; + font-size:15px; + line-height:17px; + width:318px; +} + +.blackBox .allMetacodes { + padding:5px 0; +} + +.blackBox a.button { + margin-right: 20px; + line-height: 40px; +} + +.blackBox a.button, .blackBox input.add { + float: left; + margin-top: 5px; + height: 40px; + font-family: 'LatoItalic'; + font-size: 17px; + width: auto; + padding: 0 30px; + cursor:pointer; + font-weight:normal; +} +.blackBox a.button:hover, .blackBox input.add:hover { + -webkit-box-shadow: none; + box-shadow: none; +} /* FAQ */ diff --git a/app/assets/stylesheets/in_metacode_sets.css.scss b/app/assets/stylesheets/in_metacode_sets.css.scss new file mode 100644 index 00000000..9bf15655 --- /dev/null +++ b/app/assets/stylesheets/in_metacode_sets.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the InMetacodeSets controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/metacode_sets.css.scss b/app/assets/stylesheets/metacode_sets.css.scss new file mode 100644 index 00000000..a23f1f68 --- /dev/null +++ b/app/assets/stylesheets/metacode_sets.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the MetacodeSets controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ef25a477..a29a2360 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,6 +6,7 @@ class ApplicationController < ActionController::Base helper_method :user helper_method :authenticated? + helper_method :admin? after_filter :store_location @@ -33,6 +34,13 @@ private return false end end + + def require_admin + unless authenticated? && user.admin + redirect_to root_url, notice: "You need to be an admin for that." + return false + end + end def user current_user @@ -42,5 +50,9 @@ private def authenticated? current_user end + + def admin? + current_user && current_user.admin + end end diff --git a/app/controllers/in_metacode_sets_controller.rb b/app/controllers/in_metacode_sets_controller.rb new file mode 100644 index 00000000..36a262ff --- /dev/null +++ b/app/controllers/in_metacode_sets_controller.rb @@ -0,0 +1,86 @@ +class InMetacodeSetsController < ApplicationController + + before_filter :require_admin + + # GET /in_metacode_sets + # GET /in_metacode_sets.json + def index + @in_metacode_sets = InMetacodeSet.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @in_metacode_sets } + end + end + + # GET /in_metacode_sets/1 + # GET /in_metacode_sets/1.json + def show + @in_metacode_set = InMetacodeSet.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @in_metacode_set } + end + end + + # GET /in_metacode_sets/new + # GET /in_metacode_sets/new.json + def new + @in_metacode_set = InMetacodeSet.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @in_metacode_set } + end + end + + # GET /in_metacode_sets/1/edit + def edit + @in_metacode_set = InMetacodeSet.find(params[:id]) + end + + # POST /in_metacode_sets + # POST /in_metacode_sets.json + def create + @in_metacode_set = InMetacodeSet.new(params[:in_metacode_set]) + + respond_to do |format| + if @in_metacode_set.save + format.html { redirect_to @in_metacode_set, notice: 'In metacode set was successfully created.' } + format.json { render json: @in_metacode_set, status: :created, location: @in_metacode_set } + else + format.html { render action: "new" } + format.json { render json: @in_metacode_set.errors, status: :unprocessable_entity } + end + end + end + + # PUT /in_metacode_sets/1 + # PUT /in_metacode_sets/1.json + def update + @in_metacode_set = InMetacodeSet.find(params[:id]) + + respond_to do |format| + if @in_metacode_set.update_attributes(params[:in_metacode_set]) + format.html { redirect_to @in_metacode_set, notice: 'In metacode set was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @in_metacode_set.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /in_metacode_sets/1 + # DELETE /in_metacode_sets/1.json + def destroy + @in_metacode_set = InMetacodeSet.find(params[:id]) + @in_metacode_set.destroy + + respond_to do |format| + format.html { redirect_to in_metacode_sets_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/metacode_sets_controller.rb b/app/controllers/metacode_sets_controller.rb new file mode 100644 index 00000000..9e16ae83 --- /dev/null +++ b/app/controllers/metacode_sets_controller.rb @@ -0,0 +1,119 @@ +class MetacodeSetsController < ApplicationController + + before_filter :require_admin + + # GET /metacode_sets + # GET /metacode_sets.json + def index + @metacode_sets = MetacodeSet.order("name").all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @metacode_sets } + end + end + + ### SHOW IS NOT CURRENTLY IN USE + # GET /metacode_sets/1 + # GET /metacode_sets/1.json + def show + @metacode_set = MetacodeSet.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @metacode_set } + end + end + + # GET /metacode_sets/new + # GET /metacode_sets/new.json + def new + @metacode_set = MetacodeSet.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @metacode_set } + end + end + + # GET /metacode_sets/1/edit + def edit + @metacode_set = MetacodeSet.find(params[:id]) + end + + # POST /metacode_sets + # POST /metacode_sets.json + def create + @user = current_user + @metacode_set = MetacodeSet.new(params[:metacode_set]) + @metacode_set.user_id = @user.id + + respond_to do |format| + if @metacode_set.save + # create the InMetacodeSet for all the metacodes that were selected for the set + @metacodes = params[:metacodes][:value].split(',') + @metacodes.each do |m| + InMetacodeSet.create(:metacode_id => m, :metacode_set_id => @metacode_set.id) + end + format.html { redirect_to metacode_sets_url, notice: 'Metacode set was successfully created.' } + format.json { render json: @metacode_set, status: :created, location: metacode_sets_url } + else + format.html { render action: "new" } + format.json { render json: @metacode_set.errors, status: :unprocessable_entity } + end + end + end + + # PUT /metacode_sets/1 + # PUT /metacode_sets/1.json + def update + @metacode_set = MetacodeSet.find(params[:id]) + + respond_to do |format| + if @metacode_set.update_attributes(params[:metacode_set]) + + # build an array of the IDs of the metacodes currently in the set + @currentMetacodes = @metacode_set.metacodes.map{ |m| m.id.to_s } + # get the list of desired metacodes for the set from the user input and build an array out of it + @newMetacodes = params[:metacodes][:value].split(',') + + #remove the metacodes that were in it, but now aren't + @removedMetacodes = @currentMetacodes - @newMetacodes + @removedMetacodes.each do |m| + @inmetacodeset = InMetacodeSet.find_by_metacode_id_and_metacode_set_id(m, @metacode_set.id) + @inmetacodeset.destroy + end + + # add the new metacodes + @addedMetacodes = @newMetacodes - @currentMetacodes + @addedMetacodes.each do |m| + InMetacodeSet.create(:metacode_id => m, :metacode_set_id => @metacode_set.id) + end + + format.html { redirect_to metacode_sets_url, notice: 'Metacode set was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @metacode_set.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /metacode_sets/1 + # DELETE /metacode_sets/1.json + def destroy + @metacode_set = MetacodeSet.find(params[:id]) + + #delete everything that tracks what's in the set + @metacode_set.in_metacode_sets.each do |m| + m.destroy + end + + @metacode_set.destroy + + respond_to do |format| + format.html { redirect_to metacode_sets_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/metacodes_controller.rb b/app/controllers/metacodes_controller.rb new file mode 100644 index 00000000..0f39b076 --- /dev/null +++ b/app/controllers/metacodes_controller.rb @@ -0,0 +1,89 @@ +class MetacodesController < ApplicationController + + before_filter :require_admin + + # GET /metacodes + # GET /metacodes.json + def index + @metacodes = Metacode.order("name").all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @metacodes } + end + end + + ### SHOW IS CURRENTLY DISABLED + # GET /metacodes/1 + # GET /metacodes/1.json + def show + @metacode = Metacode.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @metacode } + end + end + + # GET /metacodes/new + # GET /metacodes/new.json + def new + @metacode = Metacode.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @metacode } + end + end + + # GET /metacodes/1/edit + def edit + @metacode = Metacode.find(params[:id]) + end + + # POST /metacodes + # POST /metacodes.json + def create + @metacode = Metacode.new(params[:metacode]) + + respond_to do |format| + if @metacode.save + format.html { redirect_to metacodes_url, notice: 'Metacode was successfully created.' } + format.json { render json: @metacode, status: :created, location: metacodes_url } + else + format.html { render action: "new" } + format.json { render json: @metacode.errors, status: :unprocessable_entity } + end + end + end + + # PUT /metacodes/1 + # PUT /metacodes/1.json + def update + @metacode = Metacode.find(params[:id]) + + respond_to do |format| + if @metacode.update_attributes(params[:metacode]) + format.html { redirect_to metacodes_url, notice: 'Metacode was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @metacode.errors, status: :unprocessable_entity } + end + end + end + + + ### DESTROY IS CURRENTLY DISABLED + # DELETE /metacodes/1 + # DELETE /metacodes/1.json + def destroy + @metacode = Metacode.find(params[:id]) + @metacode.destroy + + respond_to do |format| + format.html { redirect_to metacodes_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/in_metacode_sets_helper.rb b/app/helpers/in_metacode_sets_helper.rb new file mode 100644 index 00000000..52a47cdc --- /dev/null +++ b/app/helpers/in_metacode_sets_helper.rb @@ -0,0 +1,2 @@ +module InMetacodeSetsHelper +end diff --git a/app/helpers/metacode_sets_helper.rb b/app/helpers/metacode_sets_helper.rb new file mode 100644 index 00000000..668ceb5c --- /dev/null +++ b/app/helpers/metacode_sets_helper.rb @@ -0,0 +1,2 @@ +module MetacodeSetsHelper +end diff --git a/app/helpers/metacodes_helper.rb b/app/helpers/metacodes_helper.rb new file mode 100644 index 00000000..c896d26d --- /dev/null +++ b/app/helpers/metacodes_helper.rb @@ -0,0 +1,2 @@ +module MetacodesHelper +end diff --git a/app/models/in_metacode_set.rb b/app/models/in_metacode_set.rb new file mode 100644 index 00000000..3f608587 --- /dev/null +++ b/app/models/in_metacode_set.rb @@ -0,0 +1,5 @@ +class InMetacodeSet < ActiveRecord::Base + belongs_to :metacode, :class_name => "Metacode", :foreign_key => "metacode_id" + belongs_to :metacode_set, :class_name => "MetacodeSet", :foreign_key => "metacode_set_id" + # attr_accessible :title, :body +end diff --git a/app/models/metacode.rb b/app/models/metacode.rb index 0de248be..c6888ea2 100644 --- a/app/models/metacode.rb +++ b/app/models/metacode.rb @@ -1,10 +1,17 @@ class Metacode < ActiveRecord::Base -has_many :topics + has_many :in_metacode_sets + has_many :metacode_sets, :through => :in_metacode_sets + has_many :topics def hasSelected(user) return true if user.settings.metacodes.include? self.id.to_s return false end + + def inMetacodeSet(metacode_set) + return true if self.metacode_sets.include? metacode_set + return false + end end diff --git a/app/models/metacode_set.rb b/app/models/metacode_set.rb new file mode 100644 index 00000000..6798e568 --- /dev/null +++ b/app/models/metacode_set.rb @@ -0,0 +1,6 @@ +class MetacodeSet < ActiveRecord::Base + belongs_to :user + attr_accessible :desc, :mapperContributed, :name + has_many :in_metacode_sets + has_many :metacodes, :through => :in_metacode_sets +end diff --git a/app/views/admin/_adminpanel.html.erb b/app/views/admin/_adminpanel.html.erb new file mode 100644 index 00000000..11f341e6 --- /dev/null +++ b/app/views/admin/_adminpanel.html.erb @@ -0,0 +1,6 @@ +<%= link_to 'Metacode Sets', metacode_sets_path, { :class => 'button' }%> +<%= link_to 'New Set', new_metacode_set_path, { :class => 'button' }%> +<%= link_to 'Metacodes', metacodes_path, { :class => 'button' }%> +<%= link_to 'New Metacode', new_metacode_path, { :class => 'button' }%> +

+
diff --git a/app/views/in_metacode_sets/_form.html.erb b/app/views/in_metacode_sets/_form.html.erb new file mode 100644 index 00000000..8af37701 --- /dev/null +++ b/app/views/in_metacode_sets/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@in_metacode_set) do |f| %> + <% if @in_metacode_set.errors.any? %> +
+

<%= pluralize(@in_metacode_set.errors.count, "error") %> prohibited this in_metacode_set from being saved:

+ +
    + <% @in_metacode_set.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :metacode %>
+ <%= f.text_field :metacode %> +
+
+ <%= f.label :metacode_set %>
+ <%= f.text_field :metacode_set %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/in_metacode_sets/edit.html.erb b/app/views/in_metacode_sets/edit.html.erb new file mode 100644 index 00000000..c94b7b78 --- /dev/null +++ b/app/views/in_metacode_sets/edit.html.erb @@ -0,0 +1,6 @@ +

Editing in_metacode_set

+ +<%= render 'form' %> + +<%= link_to 'Show', @in_metacode_set %> | +<%= link_to 'Back', in_metacode_sets_path %> diff --git a/app/views/in_metacode_sets/index.html.erb b/app/views/in_metacode_sets/index.html.erb new file mode 100644 index 00000000..57753a5d --- /dev/null +++ b/app/views/in_metacode_sets/index.html.erb @@ -0,0 +1,25 @@ +

Listing in_metacode_sets

+ + + + + + + + + + +<% @in_metacode_sets.each do |in_metacode_set| %> + + + + + + + +<% end %> +
MetacodeMetacode set
<%= in_metacode_set.metacode %><%= in_metacode_set.metacode_set %><%= link_to 'Show', in_metacode_set %><%= link_to 'Edit', edit_in_metacode_set_path(in_metacode_set) %><%= link_to 'Destroy', in_metacode_set, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New In metacode set', new_in_metacode_set_path %> diff --git a/app/views/in_metacode_sets/new.html.erb b/app/views/in_metacode_sets/new.html.erb new file mode 100644 index 00000000..0e1d596b --- /dev/null +++ b/app/views/in_metacode_sets/new.html.erb @@ -0,0 +1,5 @@ +

New in_metacode_set

+ +<%= render 'form' %> + +<%= link_to 'Back', in_metacode_sets_path %> diff --git a/app/views/in_metacode_sets/show.html.erb b/app/views/in_metacode_sets/show.html.erb new file mode 100644 index 00000000..2b69e016 --- /dev/null +++ b/app/views/in_metacode_sets/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Metacode: + <%= @in_metacode_set.metacode %> +

+ +

+ Metacode set: + <%= @in_metacode_set.metacode_set %> +

+ + +<%= link_to 'Edit', edit_in_metacode_set_path(@in_metacode_set) %> | +<%= link_to 'Back', in_metacode_sets_path %> diff --git a/app/views/layouts/_account.html.erb b/app/views/layouts/_account.html.erb index a92887a9..2fa1ebc0 100644 --- a/app/views/layouts/_account.html.erb +++ b/app/views/layouts/_account.html.erb @@ -9,6 +9,9 @@
  • My Maps
  • <%= link_to "Settings", edit_user_url(account) %>
  • + <% if account.admin %> +
  • <%= link_to "Admin", metacodes_path %>
  • + <% end %>
  • Share Invite
  • <%= link_to "Logout", "/sign_out", id: "Logout" %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6bc75d8a..8d2178db 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -24,7 +24,7 @@ var imgArray = new Object(); <% Metacode.all.each do |m| %> - imgArray['<%= m.name %>'] = new Image(); imgArray['<%= m.name %>'].src = '/assets/<%= m.icon %>'; + imgArray['<%= m.name %>'] = new Image(); imgArray['<%= m.name %>'].src = '<%= m.icon %>'; <% end %> <%= stylesheet_link_tag "application", :media => "all" %> diff --git a/app/views/main/_filterbymetacode.html.erb b/app/views/main/_filterbymetacode.html.erb index 8bfca541..41ea33f5 100644 --- a/app/views/main/_filterbymetacode.html.erb +++ b/app/views/main/_filterbymetacode.html.erb @@ -9,7 +9,7 @@ <% @list = '' %> <% Metacode.order("name").all.each_with_index do |m, index| %> - <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> + <% @list += '
  • ' + m.name + '

    ' + m.name.downcase + '

  • ' %> categoryVisible['<%= m.name %>'] = true; <% end %> diff --git a/app/views/main/_metacodeoptions.html.erb b/app/views/main/_metacodeoptions.html.erb index 7b3556ef..9fbf3b51 100644 --- a/app/views/main/_metacodeoptions.html.erb +++ b/app/views/main/_metacodeoptions.html.erb @@ -7,7 +7,7 @@
      <% Metacode.order("name").all.each do |m| %>
    • - <%= m.name %> + <%= m.name %> <%= m.name %>
    • diff --git a/app/views/maps/_newtopic.html.erb b/app/views/maps/_newtopic.html.erb index d0b5e546..1bf9a218 100644 --- a/app/views/maps/_newtopic.html.erb +++ b/app/views/maps/_newtopic.html.erb @@ -12,7 +12,7 @@ <% end %> <% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %> <% @metacodes.each do |metacode| %> - <%= metacode.name %> + <%= metacode.name %> <% end %> <%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %> diff --git a/app/views/metacode_sets/_form.html.erb b/app/views/metacode_sets/_form.html.erb new file mode 100644 index 00000000..22815b60 --- /dev/null +++ b/app/views/metacode_sets/_form.html.erb @@ -0,0 +1,81 @@ +<%= form_for(@metacode_set) do |f| %> + <% if @metacode_set.errors.any? %> +
      +

      <%= pluralize(@metacode_set.errors.count, "error") %> prohibited this metacode set from being saved:

      + +
        + <% @metacode_set.errors.full_messages.each do |msg| %> +
      • <%= msg %>
      • + <% end %> +
      +
      + <% end %> + +
      + <%= f.label :name %> + <%= f.text_field :name %> +
      +
      +
      + <%= f.label :desc, "Description" %> + <%= f.text_area :desc, :cols => "40", :rows => "4" %> +
      +
      + +
      + +

      Choose Metacodes

      +
      Select AllUnselect All
      +
      +
      +
        + <% $i = 0 %> + <% @m = Metacode.order("name").all %> + <% while $i < (Metacode.all.length / 4) do %> +
      • class="toggledOff"<% end %> > + <%= @m[$i].name %> +

        <%= @m[$i].name.downcase %>

        +
        +
      • + <% $i += 1 %> + <% end %> +
      +
        + <% while $i < (Metacode.all.length / 4 * 2) do %> +
      • class="toggledOff"<% end %> > + <%= @m[$i].name %> +

        <%= @m[$i].name.downcase %>

        +
        +
      • + <% $i += 1 %> + <% end %> +
      +
        + <% while $i < (Metacode.all.length / 4 * 3) do %> +
      • class="toggledOff"<% end %> > + <%= @m[$i].name %> +

        <%= @m[$i].name.downcase %>

        +
        +
      • + <% $i += 1 %> + <% end %> +
      +
        + <% while $i < Metacode.all.length do %> +
      • class="toggledOff"<% end %> > + <%= @m[$i].name %> +

        <%= @m[$i].name.downcase %>

        +
        +
      • + <% $i += 1 %> + <% end %> +
      +
      + <%= hidden_field(:metacodes, :value, {:value => 0}) %> +
      + +
      + <%= link_to 'Cancel', metacode_sets_path, { :class => 'button' }%> + <%= f.submit :class => 'add' %> +
      +<% end %> \ No newline at end of file diff --git a/app/views/metacode_sets/edit.html.erb b/app/views/metacode_sets/edit.html.erb new file mode 100644 index 00000000..c43741ca --- /dev/null +++ b/app/views/metacode_sets/edit.html.erb @@ -0,0 +1,58 @@ +

      + Edit +

      + +
      +<%= render 'form' %> +
      + + diff --git a/app/views/metacode_sets/index.html.erb b/app/views/metacode_sets/index.html.erb new file mode 100644 index 00000000..37aa2d3b --- /dev/null +++ b/app/views/metacode_sets/index.html.erb @@ -0,0 +1,41 @@ +

      + Metacode Sets +

      + +
      +<%= render :partial => 'admin/adminpanel' %> +
      + + + + + + + +<% @metacode_sets.each do |metacode_set| %> + + + + + +<% end %> +
      NameDescriptionMetacodes
      + <%= metacode_set.name %>
      + <%= link_to 'Edit', edit_metacode_set_path(metacode_set) %>
      + <%= link_to 'Delete', metacode_set, method: :delete, data: { confirm: 'Are you sure?' } %> +
      <%= metacode_set.desc %> + <% metacode_set.metacodes.each_with_index do |metacode, index| %> + + <% if (index+1)%4 == 0 %> +
      + <% end %> + <% end %> +
      +
      +
      + + \ No newline at end of file diff --git a/app/views/metacode_sets/new.html.erb b/app/views/metacode_sets/new.html.erb new file mode 100644 index 00000000..6fbb8218 --- /dev/null +++ b/app/views/metacode_sets/new.html.erb @@ -0,0 +1,58 @@ +

      + New Metacode Set +

      + +
      +<%= render 'form' %> +
      + + \ No newline at end of file diff --git a/app/views/metacode_sets/show.html.erb b/app/views/metacode_sets/show.html.erb new file mode 100644 index 00000000..ab449dc1 --- /dev/null +++ b/app/views/metacode_sets/show.html.erb @@ -0,0 +1,19 @@ +

      + <%= @metacode_set.name %> +

      + +
      +

      + Name: + <%= @metacode_set.name %> +

      + +

      + Description: + <%= @metacode_set.desc %> +

      + + +<%= link_to 'Edit', edit_metacode_set_path(@metacode_set) %> | +<%= link_to 'Back', metacode_sets_path %> +
      \ No newline at end of file diff --git a/app/views/metacodes/_form.html.erb b/app/views/metacodes/_form.html.erb new file mode 100644 index 00000000..b41f409d --- /dev/null +++ b/app/views/metacodes/_form.html.erb @@ -0,0 +1,28 @@ +<%= form_for(@metacode) do |f| %> + <% if @metacode.errors.any? %> +
      +

      <%= pluralize(@metacode.errors.count, "error") %> prohibited this metacode from being saved:

      + +
        + <% @metacode.errors.full_messages.each do |msg| %> +
      • <%= msg %>
      • + <% end %> +
      +
      + <% end %> + +
      + <%= f.label :name %> + <%= f.text_field :name %> +
      +
      +
      + <%= f.label :icon %> + <%= f.text_field :icon %> +
      +
      +
      + <%= link_to 'Cancel', metacodes_path, { :class => 'button' }%> + <%= f.submit :class => 'add' %> +
      +<% end %> diff --git a/app/views/metacodes/edit.html.erb b/app/views/metacodes/edit.html.erb new file mode 100644 index 00000000..bfb27aa0 --- /dev/null +++ b/app/views/metacodes/edit.html.erb @@ -0,0 +1,7 @@ +

      + Edit +

      + +
      +<%= render 'form' %> +
      \ No newline at end of file diff --git a/app/views/metacodes/index.html.erb b/app/views/metacodes/index.html.erb new file mode 100644 index 00000000..dea08a6f --- /dev/null +++ b/app/views/metacodes/index.html.erb @@ -0,0 +1,31 @@ +

      + Metacodes +

      + +
      +<%= render :partial => 'admin/adminpanel' %> +
      + + + + + + + + +<% @metacodes.each do |metacode| %> + + + + + + +<% end %> +
      NameIcon
      <%= metacode.name %><%= metacode.icon %><%= link_to 'Edit', edit_metacode_path(metacode) %>
      +
      + + \ No newline at end of file diff --git a/app/views/metacodes/new.html.erb b/app/views/metacodes/new.html.erb new file mode 100644 index 00000000..ccd6fd1d --- /dev/null +++ b/app/views/metacodes/new.html.erb @@ -0,0 +1,7 @@ +

      + New Metacode +

      + +
      +<%= render 'form' %> +
      \ No newline at end of file diff --git a/app/views/metacodes/show.html.erb b/app/views/metacodes/show.html.erb new file mode 100644 index 00000000..d987a575 --- /dev/null +++ b/app/views/metacodes/show.html.erb @@ -0,0 +1,19 @@ +

      + <%= @metacode.name %> +

      + +
      +

      + Name: + <%= @metacode.name %> +

      + +

      + Icon: + <%= @metacode.icon %> +

      + + +<%= link_to 'Edit', edit_metacode_path(@metacode) %> | +<%= link_to 'Back', metacodes_path %> +
      \ No newline at end of file diff --git a/app/views/topics/_new.html.erb b/app/views/topics/_new.html.erb index 68ddb09d..3433411c 100644 --- a/app/views/topics/_new.html.erb +++ b/app/views/topics/_new.html.erb @@ -14,7 +14,7 @@ <% end %> <% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %> <% @metacodes.each do |metacode| %> - <%= metacode.name %> + <%= metacode.name %> <% end %> <%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 5de14fc8..c0e9ce0c 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -18,7 +18,7 @@ <% @m = Metacode.order("name").all %> <% while $i < (Metacode.all.length / 4) do %>
    • class="toggledOff"<% end %> > - <%= @m[$i].name %> + <%= @m[$i].name %>

      <%= @m[$i].name.downcase %>

    • @@ -28,7 +28,7 @@
        <% while $i < (Metacode.all.length / 4 * 2) do %>
      • class="toggledOff"<% end %> > - <%= @m[$i].name %> + <%= @m[$i].name %>

        <%= @m[$i].name.downcase %>

      • @@ -38,7 +38,7 @@
          <% while $i < (Metacode.all.length / 4 * 3) do %>
        • class="toggledOff"<% end %> > - <%= @m[$i].name %> + <%= @m[$i].name %>

          <%= @m[$i].name.downcase %>

        • @@ -48,7 +48,7 @@
            <% while $i < Metacode.all.length do %>
          • class="toggledOff"<% end %> > - <%= @m[$i].name %> + <%= @m[$i].name %>

            <%= @m[$i].name.downcase %>

          • diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 183e9128..fc2581e0 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -9,8 +9,12 @@ Devise.setup do |config| # Configure the class responsible to send e-mails. # config.mailer = "Devise::Mailer" + + if Rails.env.development? + #config.secret_key = 'f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73ee6c94675b62fe1f6d52fa7ba8196b33031f0d2f3b67e27ea07693c52ecebccb01700cad614' + end if Rails.env.production? - #config.secret_key = 'd91ba0da95749174ee2b8922034783cbde4945409ed28b13383e18e72844beb74467f8199e9e216f0687cd2290c6e46bf74da24486d14bba3671d76c5b10c753' + config.secret_key = 'd91ba0da95749174ee2b8922034783cbde4945409ed28b13383e18e72844beb74467f8199e9e216f0687cd2290c6e46bf74da24486d14bba3671d76c5b10c753' end # ==> ORM configuration diff --git a/config/routes.rb b/config/routes.rb index 58e1d0fc..69851d6e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,9 @@ ISSAD::Application.routes.draw do + resources :in_metacode_sets + resources :metacode_sets, :except => [:show] + resources :metacodes, :except => [:show, :destroy] + root to: 'main#home', via: :get match 'request', to: 'main#requestinvite', via: :get, as: :request diff --git a/db/migrate/20140517115027_create_metacode_sets.rb b/db/migrate/20140517115027_create_metacode_sets.rb new file mode 100644 index 00000000..cf7d1994 --- /dev/null +++ b/db/migrate/20140517115027_create_metacode_sets.rb @@ -0,0 +1,13 @@ +class CreateMetacodeSets < ActiveRecord::Migration + def change + create_table :metacode_sets do |t| + t.string :name + t.text :desc + t.references :user + t.boolean :mapperContributed + + t.timestamps + end + add_index :metacode_sets, :user_id + end +end diff --git a/db/migrate/20140517115841_create_in_metacode_sets.rb b/db/migrate/20140517115841_create_in_metacode_sets.rb new file mode 100644 index 00000000..2933cfa4 --- /dev/null +++ b/db/migrate/20140517115841_create_in_metacode_sets.rb @@ -0,0 +1,12 @@ +class CreateInMetacodeSets < ActiveRecord::Migration + def change + create_table :in_metacode_sets do |t| + t.references :metacode + t.references :metacode_set + + t.timestamps + end + add_index :in_metacode_sets, :metacode_id + add_index :in_metacode_sets, :metacode_set_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 7d8c757f..0a8292d7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,17 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140210031525) do +ActiveRecord::Schema.define(:version => 20140517115841) 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" @@ -36,6 +46,17 @@ ActiveRecord::Schema.define(:version => 20140210031525) do t.boolean "featured" 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" diff --git a/test/fixtures/in_metacode_sets.yml b/test/fixtures/in_metacode_sets.yml new file mode 100644 index 00000000..9879c73b --- /dev/null +++ b/test/fixtures/in_metacode_sets.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +#one: +# metacode: +# metacode_set: + +#two: +# metacode: +# metacode_set: diff --git a/test/fixtures/metacode_sets.yml b/test/fixtures/metacode_sets.yml new file mode 100644 index 00000000..56bda62e --- /dev/null +++ b/test/fixtures/metacode_sets.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +#one: +# name: MyString +# desc: MyText +# user: +# mapperContributed: false + +#two: +# name: MyString +# desc: MyText +# user: +# mapperContributed: false diff --git a/test/fixtures/metacodes.yml b/test/fixtures/metacodes.yml index e2cdfbfa..a1c750e1 100644 --- a/test/fixtures/metacodes.yml +++ b/test/fixtures/metacodes.yml @@ -6,160 +6,160 @@ # one: name: Action - icon: action.png + icon: /assets/icons/action.png two: name: Activity - icon: activity.png + icon: /assets/icons/activity.png three: name: Bizarre - icon: bizarre.png + icon: /assets/icons/bizarre.png four: name: Catalyst - icon: catalyst.png + icon: /assets/icons/catalyst.png five: name: Closed - icon: closed.png + icon: /assets/icons/closed.png six: name: Experience - icon: experience.png + icon: /assets/icons/experience.png seven: name: Future Dev - icon: futuredev.png + icon: /assets/icons/futuredev.png eight: name: Group - icon: group.png + icon: /assets/icons/group.png nine: name: Idea - icon: idea.png + icon: /assets/icons/idea.png ten: name: Implication - icon: implication.png + icon: /assets/icons/implication.png eleven: name: Insight - icon: insight.png + icon: /assets/icons/insight.png twelve: name: Intention - icon: intention.png + icon: /assets/icons/intention.png thirteen: name: Knowledge - icon: knowledge.png + icon: /assets/icons/knowledge.png fourteen: name: Location - icon: location.png + icon: /assets/icons/location.png fifteen: name: Open Issue - icon: openissue.png + icon: /assets/icons/openissue.png sixteen: name: Opinion - icon: opinion.png + icon: /assets/icons/opinion.png seventeen: name: Opportunity - icon: opportunity.png + icon: /assets/icons/opportunity.png eighteen: name: Person - icon: person.png + icon: /assets/icons/person.png nineteen: name: Platform - icon: platform.png + icon: /assets/icons/platform.png twenty: name: Problem - icon: problem.png + icon: /assets/icons/problem.png twenty-one: name: Question - icon: question.png + icon: /assets/icons/question.png twenty-two: name: Reference - icon: reference.png + icon: /assets/icons/reference.png twenty-three: name: Requirement - icon: requirement.png + icon: /assets/icons/requirement.png twenty-four: name: Resource - icon: resource.png + icon: /assets/icons/resource.png twenty-five: name: Role - icon: role.png + icon: /assets/icons/role.png twenty-six: name: Task - icon: task.png + icon: /assets/icons/task.png twenty-seven: name: Tool - icon: tool.png + icon: /assets/icons/tool.png twenty-eight: name: Trajectory - icon: trajectory.png + icon: /assets/icons/trajectory.png twenty-nine: name: Argument - icon: argument.png + icon: /assets/icons/argument.png thirty: name: Con - icon: con_icon.png + icon: /assets/icons/con_icon.png thirty-one: name: Decision - icon: decision.png + icon: /assets/icons/decision.png thirty-two: name: Example - icon: example.png + icon: /assets/icons/example.png thirty-three: name: Foresight - icon: foresight.png + icon: /assets/icons/foresight.png thirty-four: name: Good Practice - icon: goodpractice.png + icon: /assets/icons/goodpractice.png thirty-five: name: List - icon: list.png + icon: /assets/icons/list.png thirty-six: name: Movie Map - icon: moviemap.png + icon: /assets/icons/moviemap.png thirty-seven: name: Note - icon: note.png + icon: /assets/icons/note.png thirty-eight: name: Pro - icon: pro.png + icon: /assets/icons/pro.png thirty-nine: name: Research - icon: research.png + icon: /assets/icons/research.png forty: name: Wildcard - icon: wildcard.png + icon: /assets/icons/wildcard.png diff --git a/test/functional/in_metacode_sets_controller_test.rb b/test/functional/in_metacode_sets_controller_test.rb new file mode 100644 index 00000000..f78ad458 --- /dev/null +++ b/test/functional/in_metacode_sets_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class InMetacodeSetsControllerTest < ActionController::TestCase + setup do + @in_metacode_set = in_metacode_sets(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:in_metacode_sets) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create in_metacode_set" do + assert_difference('InMetacodeSet.count') do + post :create, in_metacode_set: { } + end + + assert_redirected_to in_metacode_set_path(assigns(:in_metacode_set)) + end + + test "should show in_metacode_set" do + get :show, id: @in_metacode_set + assert_response :success + end + + test "should get edit" do + get :edit, id: @in_metacode_set + assert_response :success + end + + test "should update in_metacode_set" do + put :update, id: @in_metacode_set, in_metacode_set: { } + assert_redirected_to in_metacode_set_path(assigns(:in_metacode_set)) + end + + test "should destroy in_metacode_set" do + assert_difference('InMetacodeSet.count', -1) do + delete :destroy, id: @in_metacode_set + end + + assert_redirected_to in_metacode_sets_path + end +end diff --git a/test/functional/metacode_sets_controller_test.rb b/test/functional/metacode_sets_controller_test.rb new file mode 100644 index 00000000..ec06c1e4 --- /dev/null +++ b/test/functional/metacode_sets_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class MetacodeSetsControllerTest < ActionController::TestCase + setup do + @metacode_set = metacode_sets(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:metacode_sets) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create metacode_set" do + assert_difference('MetacodeSet.count') do + post :create, metacode_set: { desc: @metacode_set.desc, mapperContributed: @metacode_set.mapperContributed, name: @metacode_set.name } + end + + assert_redirected_to metacode_set_path(assigns(:metacode_set)) + end + + test "should show metacode_set" do + get :show, id: @metacode_set + assert_response :success + end + + test "should get edit" do + get :edit, id: @metacode_set + assert_response :success + end + + test "should update metacode_set" do + put :update, id: @metacode_set, metacode_set: { desc: @metacode_set.desc, mapperContributed: @metacode_set.mapperContributed, name: @metacode_set.name } + assert_redirected_to metacode_set_path(assigns(:metacode_set)) + end + + test "should destroy metacode_set" do + assert_difference('MetacodeSet.count', -1) do + delete :destroy, id: @metacode_set + end + + assert_redirected_to metacode_sets_path + end +end diff --git a/test/functional/metacodes_controller_test.rb b/test/functional/metacodes_controller_test.rb new file mode 100644 index 00000000..c15d468f --- /dev/null +++ b/test/functional/metacodes_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class MetacodesControllerTest < ActionController::TestCase + setup do + @metacode = metacodes(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:metacodes) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create metacode" do + assert_difference('Metacode.count') do + post :create, metacode: { icon: @metacode.icon, name: @metacode.name } + end + + assert_redirected_to metacode_path(assigns(:metacode)) + end + + test "should show metacode" do + get :show, id: @metacode + assert_response :success + end + + test "should get edit" do + get :edit, id: @metacode + assert_response :success + end + + test "should update metacode" do + put :update, id: @metacode, metacode: { icon: @metacode.icon, name: @metacode.name } + assert_redirected_to metacode_path(assigns(:metacode)) + end + + test "should destroy metacode" do + assert_difference('Metacode.count', -1) do + delete :destroy, id: @metacode + end + + assert_redirected_to metacodes_path + end +end diff --git a/test/unit/helpers/in_metacode_sets_helper_test.rb b/test/unit/helpers/in_metacode_sets_helper_test.rb new file mode 100644 index 00000000..64eb689a --- /dev/null +++ b/test/unit/helpers/in_metacode_sets_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class InMetacodeSetsHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/metacode_sets_helper_test.rb b/test/unit/helpers/metacode_sets_helper_test.rb new file mode 100644 index 00000000..d1983654 --- /dev/null +++ b/test/unit/helpers/metacode_sets_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class MetacodeSetsHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/metacodes_helper_test.rb b/test/unit/helpers/metacodes_helper_test.rb new file mode 100644 index 00000000..2837d55f --- /dev/null +++ b/test/unit/helpers/metacodes_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class MetacodesHelperTest < ActionView::TestCase +end diff --git a/test/unit/in_metacode_set_test.rb b/test/unit/in_metacode_set_test.rb new file mode 100644 index 00000000..1873f3d2 --- /dev/null +++ b/test/unit/in_metacode_set_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class InMetacodeSetTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/metacode_set_test.rb b/test/unit/metacode_set_test.rb new file mode 100644 index 00000000..f92bc573 --- /dev/null +++ b/test/unit/metacode_set_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MetacodeSetTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end