added ability for an admin to add metacodes and metacode sets

This commit is contained in:
Connor Turland 2014-05-17 14:57:03 -04:00
parent 53544e05a9
commit 48dc11b53d
96 changed files with 1223 additions and 80 deletions

View file

@ -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

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View file

@ -1998,7 +1998,124 @@ font-weight: bold;
}
/* Admin Pages */
#wrapper > 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 */

View file

@ -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/

View file

@ -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/

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,2 @@
module InMetacodeSetsHelper
end

View file

@ -0,0 +1,2 @@
module MetacodeSetsHelper
end

View file

@ -0,0 +1,2 @@
module MetacodesHelper
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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' }%>
<div class='clearfloat'></div>
<br />

View file

@ -0,0 +1,25 @@
<%= form_for(@in_metacode_set) do |f| %>
<% if @in_metacode_set.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@in_metacode_set.errors.count, "error") %> prohibited this in_metacode_set from being saved:</h2>
<ul>
<% @in_metacode_set.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :metacode %><br />
<%= f.text_field :metacode %>
</div>
<div class="field">
<%= f.label :metacode_set %><br />
<%= f.text_field :metacode_set %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

View file

@ -0,0 +1,6 @@
<h1>Editing in_metacode_set</h1>
<%= render 'form' %>
<%= link_to 'Show', @in_metacode_set %> |
<%= link_to 'Back', in_metacode_sets_path %>

View file

@ -0,0 +1,25 @@
<h1>Listing in_metacode_sets</h1>
<table>
<tr>
<th>Metacode</th>
<th>Metacode set</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @in_metacode_sets.each do |in_metacode_set| %>
<tr>
<td><%= in_metacode_set.metacode %></td>
<td><%= in_metacode_set.metacode_set %></td>
<td><%= link_to 'Show', in_metacode_set %></td>
<td><%= link_to 'Edit', edit_in_metacode_set_path(in_metacode_set) %></td>
<td><%= link_to 'Destroy', in_metacode_set, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New In metacode set', new_in_metacode_set_path %>

View file

@ -0,0 +1,5 @@
<h1>New in_metacode_set</h1>
<%= render 'form' %>
<%= link_to 'Back', in_metacode_sets_path %>

View file

@ -0,0 +1,15 @@
<p id="notice"><%= notice %></p>
<p>
<b>Metacode:</b>
<%= @in_metacode_set.metacode %>
</p>
<p>
<b>Metacode set:</b>
<%= @in_metacode_set.metacode_set %>
</p>
<%= link_to 'Edit', edit_in_metacode_set_path(@in_metacode_set) %> |
<%= link_to 'Back', in_metacode_sets_path %>

View file

@ -9,6 +9,9 @@
<ul>
<li class="accountIcon accountMaps"><a href="/maps/mappers/<%= account.id %>">My Maps</a></li>
<li class="accountIcon accountSettings"><%= link_to "Settings", edit_user_url(account) %></li>
<% if account.admin %>
<li class="accountIcon accountSettings"><%= link_to "Admin", metacodes_path %></li>
<% end %>
<li class="accountIcon accountInvite openLightbox" data-open="invite"><span>Share Invite</span></li>
<li class="accountIcon accountLogout"><%= link_to "Logout", "/sign_out", id: "Logout" %></li>
</ul>

View file

@ -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 %>
</script>
<%= stylesheet_link_tag "application", :media => "all" %>

View file

@ -9,7 +9,7 @@
<% @list = '' %>
<% Metacode.order("name").all.each_with_index do |m, index| %>
<% @list += '<li><img src="/assets/' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p></li>' %>
<% @list += '<li><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p></li>' %>
categoryVisible['<%= m.name %>'] = true;
<% end %>

View file

@ -7,7 +7,7 @@
<ul>
<% Metacode.order("name").all.each do |m| %>
<li>
<img width="30" height="30" src="/assets/<%= m.icon %>" alt="<%= m.name %>" />
<img width="30" height="30" src="<%= m.icon %>" alt="<%= m.name %>" />
<span class="mSelectName"><%= m.name %></span>
<div class="clearfloat"></div>
</li>

View file

@ -12,7 +12,7 @@
<% end %>
<% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %>
<% @metacodes.each do |metacode| %>
<img class="cloudcarousel" width="40" height="40" src="/assets/<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
<img class="cloudcarousel" width="40" height="40" src="<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
<% end %>
</div>
<%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %>

View file

@ -0,0 +1,81 @@
<%= form_for(@metacode_set) do |f| %>
<% if @metacode_set.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@metacode_set.errors.count, "error") %> prohibited this metacode set from being saved:</h2>
<ul>
<% @metacode_set.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
<div class="clearfloat"></div>
</div>
<div class="field">
<%= f.label :desc, "Description" %>
<%= f.text_area :desc, :cols => "40", :rows => "4" %>
<div class="clearfloat"></div>
</div>
<br />
<p>Choose Metacodes</p>
<div class="allMetacodes"><span id="showAll">Select All</span><span id="hideAll">Unselect All</span></div>
<div class="clearfloat"></div>
<div class="editMetacodes">
<ul id="filters-one">
<% $i = 0 %>
<% @m = Metacode.order("name").all %>
<% while $i < (Metacode.all.length / 4) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %> >
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-two">
<% while $i < (Metacode.all.length / 4 * 2) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %> >
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-three">
<% while $i < (Metacode.all.length / 4 * 3) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %> >
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-four">
<% while $i < Metacode.all.length do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %> >
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
</div>
<%= hidden_field(:metacodes, :value, {:value => 0}) %>
<div class="clearfloat"></div>
<div class="actions">
<%= link_to 'Cancel', metacode_sets_path, { :class => 'button' }%>
<%= f.submit :class => 'add' %>
</div>
<% end %>

View file

@ -0,0 +1,58 @@
<h1 class='index'>
Edit
</h1>
<div class='blackBox'>
<%= render 'form' %>
</div>
<script>
var selectMetacodes = new Array;
var allMetacodes = new Array;
<% Metacode.all.each do |m| %>
<% if m.inMetacodeSet(@metacode_set) %>
selectMetacodes.push("<%= m.id %>");
<% end %>
allMetacodes.push("<%= m.id %>");
<% end %>
$(document).ready(function() {
$('#metacodes_value').val(selectMetacodes.toString());
$('.editMetacodes li').click(function() {
console.log($(this).attr('class'));
if ($(this).attr('class') != 'toggledOff') {
$(this).addClass('toggledOff');
var value_to_remove = $(this).attr('id');
selectMetacodes.splice(selectMetacodes.indexOf(value_to_remove), 1);
$('#metacodes_value').val(selectMetacodes.toString());
}
else if ($(this).attr('class') == 'toggledOff') {
$(this).removeClass('toggledOff');
selectMetacodes.push($(this).attr('id'));
$('#metacodes_value').val(selectMetacodes.toString());
}
});
$('#showAll').click(function() {
$('.editMetacodes li').removeClass('toggledOff');
selectMetacodes = allMetacodes;
$('#metacodes_value').val(selectMetacodes.toString());
});
$('#hideAll').click(function() {
$('.editMetacodes li').addClass('toggledOff');
selectMetacodes = [];
$('#metacodes_value').val(0);
});
$('.edit_metacode_set').bind('submit', function(event) {
if (selectMetacodes.length == 0) {
alert('Would you pretty please select at least one metacode for the set?');
return false;
}
});
$('.blackBox').height( (parseInt($('body').height()) - 40) ).mCustomScrollbar();
});
</script>

View file

@ -0,0 +1,41 @@
<h1 class='index'>
Metacode Sets
</h1>
<div class='blackBox'>
<%= render :partial => 'admin/adminpanel' %>
<br />
<table>
<tr>
<th>Name</th>
<th class='metacodeSetsDescription'>Description</th>
<th>Metacodes</th>
</tr>
<% @metacode_sets.each do |metacode_set| %>
<tr>
<td>
<%= metacode_set.name %><br />
<%= link_to 'Edit', edit_metacode_set_path(metacode_set) %><br />
<%= link_to 'Delete', metacode_set, method: :delete, data: { confirm: 'Are you sure?' } %>
</td>
<td><%= metacode_set.desc %></td>
<td style='position:relative;'>
<% metacode_set.metacodes.each_with_index do |metacode, index| %>
<img width='40' style='float:left;' src='<%= metacode.icon %>' />
<% if (index+1)%4 == 0 %>
<div class='clearfloat'></div>
<% end %>
<% end %>
<div class='clearfloat'></div>
</td>
</tr>
<% end %>
</table>
</div>
<script>
$(document).ready(function() {
$('.blackBox').height( (parseInt($('body').height()) - 40) ).mCustomScrollbar({ advanced: { updateOnContentResize: true }});
});
</script>

View file

@ -0,0 +1,58 @@
<h1 class='index'>
New Metacode Set
</h1>
<div class='blackBox'>
<%= render 'form' %>
</div>
<script>
var selectMetacodes = new Array;
var allMetacodes = new Array;
<% Metacode.all.each do |m| %>
<% if m.inMetacodeSet(@metacode_set) %>
selectMetacodes.push("<%= m.id %>");
<% end %>
allMetacodes.push("<%= m.id %>");
<% end %>
$(document).ready(function() {
$('#metacodes_value').val(selectMetacodes.toString());
$('.editMetacodes li').click(function() {
console.log($(this).attr('class'));
if ($(this).attr('class') != 'toggledOff') {
$(this).addClass('toggledOff');
var value_to_remove = $(this).attr('id');
selectMetacodes.splice(selectMetacodes.indexOf(value_to_remove), 1);
$('#metacodes_value').val(selectMetacodes.toString());
}
else if ($(this).attr('class') == 'toggledOff') {
$(this).removeClass('toggledOff');
selectMetacodes.push($(this).attr('id'));
$('#metacodes_value').val(selectMetacodes.toString());
}
});
$('#showAll').click(function() {
$('.editMetacodes li').removeClass('toggledOff');
selectMetacodes = allMetacodes;
$('#metacodes_value').val(selectMetacodes.toString());
});
$('#hideAll').click(function() {
$('.editMetacodes li').addClass('toggledOff');
selectMetacodes = [];
$('#metacodes_value').val(0);
});
$('#new_metacode_set').bind('submit', function(event) {
if (selectMetacodes.length == 0) {
alert('Would you pretty please select at least one metacode for the set?');
return false;
}
});
$('.blackBox').height( (parseInt($('body').height()) - 40) ).mCustomScrollbar();
});
</script>

View file

@ -0,0 +1,19 @@
<h1 class='index'>
<%= @metacode_set.name %>
</h1>
<div class='blackBox'>
<p>
<b>Name:</b>
<%= @metacode_set.name %>
</p>
<p>
<b>Description:</b>
<%= @metacode_set.desc %>
</p>
<%= link_to 'Edit', edit_metacode_set_path(@metacode_set) %> |
<%= link_to 'Back', metacode_sets_path %>
</div>

View file

@ -0,0 +1,28 @@
<%= form_for(@metacode) do |f| %>
<% if @metacode.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@metacode.errors.count, "error") %> prohibited this metacode from being saved:</h2>
<ul>
<% @metacode.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
<div class="clearfloat"></div>
</div>
<div class="field">
<%= f.label :icon %>
<%= f.text_field :icon %>
<div class="clearfloat"></div>
</div>
<div class="actions">
<%= link_to 'Cancel', metacodes_path, { :class => 'button' }%>
<%= f.submit :class => 'add' %>
</div>
<% end %>

View file

@ -0,0 +1,7 @@
<h1 class='index'>
Edit
</h1>
<div class='blackBox'>
<%= render 'form' %>
</div>

View file

@ -0,0 +1,31 @@
<h1 class='index'>
Metacodes
</h1>
<div class='blackBox'>
<%= render :partial => 'admin/adminpanel' %>
<br />
<table>
<tr>
<th>Name</th>
<th>Icon</th>
<th></th>
<th></th>
</tr>
<% @metacodes.each do |metacode| %>
<tr>
<td><%= metacode.name %></td>
<td><%= metacode.icon %></td>
<td><img width='40' src='<%= metacode.icon %>' /></td>
<td><%= link_to 'Edit', edit_metacode_path(metacode) %></td>
</tr>
<% end %>
</table>
</div>
<script>
$(document).ready(function() {
$('.blackBox').height( (parseInt($('body').height()) - 40) ).mCustomScrollbar({ advanced: { updateOnContentResize: true }});
});
</script>

View file

@ -0,0 +1,7 @@
<h1 class='index'>
New Metacode
</h1>
<div class='blackBox'>
<%= render 'form' %>
</div>

View file

@ -0,0 +1,19 @@
<h1 class='index'>
<%= @metacode.name %>
</h1>
<div class='blackBox'>
<p>
<b>Name:</b>
<%= @metacode.name %>
</p>
<p>
<b>Icon:</b>
<%= @metacode.icon %>
</p>
<%= link_to 'Edit', edit_metacode_path(@metacode) %> |
<%= link_to 'Back', metacodes_path %>
</div>

View file

@ -14,7 +14,7 @@
<% end %>
<% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %>
<% @metacodes.each do |metacode| %>
<img class="cloudcarousel" width="40" height="40" src="/assets/<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
<img class="cloudcarousel" width="40" height="40" src="<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
<% end %>
</div>
<%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %>

View file

@ -18,7 +18,7 @@
<% @m = Metacode.order("name").all %>
<% while $i < (Metacode.all.length / 4) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
@ -28,7 +28,7 @@
<ul id="filters-two">
<% while $i < (Metacode.all.length / 4 * 2) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
@ -38,7 +38,7 @@
<ul id="filters-three">
<% while $i < (Metacode.all.length / 4 * 3) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
@ -48,7 +48,7 @@
<ul id="filters-four">
<% while $i < Metacode.all.length do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

9
test/fixtures/in_metacode_sets.yml vendored Normal file
View file

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
#one:
# metacode:
# metacode_set:
#two:
# metacode:
# metacode_set:

13
test/fixtures/metacode_sets.yml vendored Normal file
View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,4 @@
require 'test_helper'
class InMetacodeSetsHelperTest < ActionView::TestCase
end

View file

@ -0,0 +1,4 @@
require 'test_helper'
class MetacodeSetsHelperTest < ActionView::TestCase
end

View file

@ -0,0 +1,4 @@
require 'test_helper'
class MetacodesHelperTest < ActionView::TestCase
end

View file

@ -0,0 +1,7 @@
require 'test_helper'
class InMetacodeSetTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require 'test_helper'
class MetacodeSetTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end