Merge pull request #477 from metamaps/feature/metacode-icon-on-aws

metacode icons on aws (fixes #445)
This commit is contained in:
Devin Howard 2016-02-28 12:19:00 +08:00
commit 8916ff20b6
12 changed files with 332 additions and 128 deletions

View file

@ -272,6 +272,3 @@ DEPENDENCIES
tunemygc tunemygc
uglifier uglifier
uservoice-ruby uservoice-ruby
BUNDLED WITH
1.11.2

View file

@ -1,63 +0,0 @@
.allMetacodes {
float:left;
}
.allMetacodes span {
margin:4px 8px;
color:#67AF9F;
}
.editMetacodes {
z-index:12;
width:auto;
color: #67AF9F;
padding:10px;
float:left;
}
.editMetacodes ul {
display:block;
}
.editMetacodes ul li {
clear:both;
list-style-type:none;
display:block;
padding:3px;
}
.editMetacodes ul img {
width:40px;
height:40px;
float:left;
}
.editMetacodes ul p {
float:left;
display: block;
margin: 0;
background: none;
padding: 10px 4px 2px 4px;
}
.editMetacodes #filters-one {
float:left;
}
.editMetacodes #filters-two {
float:left;
}
.editMetacodes #filters-three {
float:left;
}
.editMetacodes #filters-four {
float:left;
}
.editMetacodes li.toggledOff {
opacity: 0.4;
}

View file

@ -0,0 +1,188 @@
.allMetacodes {
float:left;
span {
margin:4px 8px;
color:#67AF9F;
}
}
.editMetacodes {
z-index:12;
width:auto;
color: #67AF9F;
padding:10px;
float:left;
ul {
display:block;
}
ul li {
clear:both;
list-style-type:none;
display:block;
padding:3px;
}
ul img {
width:40px;
height:40px;
float:left;
}
ul p {
float:left;
display: block;
margin: 0;
background: none;
padding: 10px 4px 2px 4px;
}
#filters-one {
float:left;
}
#filters-two {
float:left;
}
#filters-three {
float:left;
}
#filters-four {
float:left;
}
li.toggledOff {
opacity: 0.4;
}
}
.blackBox {
width: 760px;
margin: 0 auto;
padding: 20px 0 60px 20px;
background: rgba(0, 0, 0, 0.4);
color: white;
overflow: hidden;
position: relative;
.metacodeSetsDescription {
width: 314px;
}
td.metacodeSetDesc {
width: 314px;
word-wrap: break-word;
}
.metacodeSetImage {
width: 36px;
height: 36px;
float: left;
}
tr {
display: table-row;
}
tr:nth-child(odd) {
background: rgba(0, 0, 0, 0.2);
}
tr:nth-child(even) {
background: rgba(0, 0, 0, 0.3);
}
th,
td {
padding: 10px;
}
td.iconURL {
max-width: 415px;
word-wrap: break-word;
}
.field {
margin: 15px 0 5px;
}
label {
float: left;
width: 100px;
margin-right: 15px;
margin-top: 0px;
}
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;
}
textarea:hover,
input[type="text"]: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);
}
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;
}
.allMetacodes {
padding: 5px 0;
}
a.button {
margin-right: 20px;
line-height: 40px;
}
a.button,
input.add {
float: left;
margin-top: 5px;
height: 40px;
font-size: 17px;
width: auto;
padding: 0 30px;
cursor: pointer;
font-weight: normal;
}
a.button:hover,
input.add:hover {
-webkit-box-shadow: none;
box-shadow: none;
}
}

View file

@ -5,9 +5,6 @@ class MetacodesController < ApplicationController
# GET /metacodes.json # GET /metacodes.json
def index def index
@metacodes = Metacode.order("name").all @metacodes = Metacode.order("name").all
@metacodes.map do |metacode|
metacode.icon = ActionController::Base.helpers.asset_path(metacode.icon)
end
respond_to do |format| respond_to do |format|
format.html { format.html {
@ -73,6 +70,6 @@ class MetacodesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def metacode_params def metacode_params
params.require(:metacode).permit(:id, :name, :icon, :color) params.require(:metacode).permit(:id, :name, :aws_icon, :manual_icon, :color)
end end
end end

View file

@ -3,6 +3,35 @@ class Metacode < ActiveRecord::Base
has_many :metacode_sets, :through => :in_metacode_sets has_many :metacode_sets, :through => :in_metacode_sets
has_many :topics has_many :topics
# This method associates the attribute ":aws_icon" with a file attachment
has_attached_file :aws_icon, :styles => {
:ninetysix => ['96x96#', :png],
},
:default_url => 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_wildcard.png'
# Validate the attached icon is image/jpg, image/png, etc
validates_attachment_content_type :aws_icon, :content_type => /\Aimage\/.*\Z/
validate :aws_xor_manual_icon
validate :manual_icon_https
before_create do
self.manual_icon = nil if self.manual_icon == ""
end
def icon(*args)
if manual_icon.present?
manual_icon
else
aws_icon(*args)
end
end
def as_json(options={})
default = super(options)
default[:icon] = icon
default.except('aws_icon_file_name', 'aws_icon_content_type', 'aws_icon_file_size', 'aws_icon_updated_at', 'manual_icon')
end
def hasSelected(user) def hasSelected(user)
return true if user.settings.metacodes.include? self.id.to_s return true if user.settings.metacodes.include? self.id.to_s
return false return false
@ -12,4 +41,23 @@ class Metacode < ActiveRecord::Base
return true if self.metacode_sets.include? metacode_set return true if self.metacode_sets.include? metacode_set
return false return false
end end
private
def aws_xor_manual_icon
if aws_icon.blank? && manual_icon.blank?
errors.add(:base, "Either aws_icon or manual_icon is required")
end
if aws_icon.present? && manual_icon.present?
errors.add(:base, "Specify aws_icon or manual_icon, not both")
end
end
def manual_icon_https
if manual_icon.present?
unless manual_icon.starts_with? 'https'
errors.add(:base, "Manual icon must begin with https")
end
end
end
end end

View file

@ -2,7 +2,6 @@
<% if @metacode.errors.any? %> <% if @metacode.errors.any? %>
<div id="error_explanation"> <div id="error_explanation">
<h2><%= pluralize(@metacode.errors.count, "error") %> prohibited this metacode from being saved:</h2> <h2><%= pluralize(@metacode.errors.count, "error") %> prohibited this metacode from being saved:</h2>
<ul> <ul>
<% @metacode.errors.full_messages.each do |msg| %> <% @metacode.errors.full_messages.each do |msg| %>
<li><%= msg %></li> <li><%= msg %></li>
@ -16,9 +15,20 @@
<%= f.text_field :name %> <%= f.text_field :name %>
<div class="clearfloat"></div> <div class="clearfloat"></div>
</div> </div>
<% unless @metacode.new_record? %>
<div class="field"> <div class="field">
<%= f.label :icon %> <%= f.label 'Current Icon' %>
<%= f.text_field :icon %> <%= image_tag @metacode.icon, width: 96 %>
</div>
<% end %>
<div class="field">
<% if @metacode.new_record? %>
<%= f.label 'Icon' %>
<% else %>
<%= f.label 'Replace Icon: ' %>
<% end %>
<%= f.hidden_field :manual_icon, value: nil %>
<%= f.file_field :aws_icon %>
<div class="clearfloat"></div> <div class="clearfloat"></div>
</div> </div>
<div class="field"> <div class="field">

View file

@ -14,7 +14,7 @@
<% @metacodes.each do |metacode| %> <% @metacodes.each do |metacode| %>
<tr> <tr>
<td><%= metacode.name %></td> <td><%= metacode.name %></td>
<td class="iconURL"><%= asset_path metacode.icon %></td> <td class="iconURL"><%= metacode.icon %></td>
<% if metacode.color %> <% if metacode.color %>
<td class="iconColor" style="background-color: <%= metacode.color %>"> <td class="iconColor" style="background-color: <%= metacode.color %>">
<%= metacode.color %> <%= metacode.color %>
@ -22,7 +22,7 @@
<% else %> <% else %>
<td></td> <td></td>
<% end %> <% end %>
<td><img width='40' src='<%= asset_path metacode.icon %>' /></td> <td><%= image_tag metacode.icon, width: 40 %></td>
<td><%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %></td> <td><%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %></td>
</tr> </tr>
<% end %> <% end %>

View file

@ -0,0 +1,8 @@
class AddAttachmentIconToMetacodes < ActiveRecord::Migration
def change
change_table :metacodes do |t|
t.rename :icon, :manual_icon
t.attachment :aws_icon
end
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160120061513) do ActiveRecord::Schema.define(version: 20160223061711) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -63,6 +63,19 @@ ActiveRecord::Schema.define(version: 20160120061513) do
add_index "maps", ["user_id"], name: "index_maps_on_user_id", using: :btree add_index "maps", ["user_id"], name: "index_maps_on_user_id", using: :btree
create_table "messages", force: :cascade do |t|
t.text "message"
t.integer "user_id"
t.integer "resource_id"
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "messages", ["resource_id"], name: "index_messages_on_resource_id", using: :btree
add_index "messages", ["resource_type"], name: "index_messages_on_resource_type", using: :btree
add_index "messages", ["user_id"], name: "index_messages_on_user_id", using: :btree
create_table "metacode_sets", force: :cascade do |t| create_table "metacode_sets", force: :cascade do |t|
t.string "name" t.string "name"
t.text "desc" t.text "desc"
@ -76,10 +89,14 @@ ActiveRecord::Schema.define(version: 20160120061513) do
create_table "metacodes", force: :cascade do |t| create_table "metacodes", force: :cascade do |t|
t.text "name" t.text "name"
t.string "icon" t.string "manual_icon"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "color" t.string "color"
t.string "aws_icon_file_name"
t.string "aws_icon_content_type"
t.integer "aws_icon_file_size"
t.datetime "aws_icon_updated_at"
end end
create_table "synapses", force: :cascade do |t| create_table "synapses", force: :cascade do |t|

View file

@ -24,283 +24,283 @@ User.new({
## METACODES ## METACODES
Metacode.create({ Metacode.create({
name: 'Action', name: 'Action',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png',
color: '#BD6C85' color: '#BD6C85'
}) })
Metacode.create({ Metacode.create({
name: 'Activity', name: 'Activity',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_activity.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_activity.png',
color: '#6EBF65' color: '#6EBF65'
}) })
Metacode.create({ Metacode.create({
name: 'Catalyst', name: 'Catalyst',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_catalyst.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_catalyst.png',
color: '#EF8964', color: '#EF8964',
}) })
Metacode.create({ Metacode.create({
name: 'Closed', name: 'Closed',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_closedissue.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_closedissue.png',
color: '#ABB49F', color: '#ABB49F',
}) })
Metacode.create({ Metacode.create({
name: 'Process', name: 'Process',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_process.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_process.png',
color: '#BDB25E', color: '#BDB25E',
}) })
Metacode.create({ Metacode.create({
name: 'Future', name: 'Future',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_futuredev.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_futuredev.png',
color: '#25A17F', color: '#25A17F',
}) })
Metacode.create({ Metacode.create({
name: 'Group', name: 'Group',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_group.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_group.png',
color: '#7076BC', color: '#7076BC',
}) })
Metacode.create({ Metacode.create({
name: 'Implication', name: 'Implication',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_implication.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_implication.png',
color: '#83DECA', color: '#83DECA',
}) })
Metacode.create({ Metacode.create({
name: 'Insight', name: 'Insight',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_insight.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_insight.png',
color: '#B074AD', color: '#B074AD',
}) })
Metacode.create({ Metacode.create({
name: 'Intention', name: 'Intention',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_intention.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_intention.png',
color: '#BAEAFF', color: '#BAEAFF',
}) })
Metacode.create({ Metacode.create({
name: 'Knowledge', name: 'Knowledge',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_knowledge.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_knowledge.png',
color: '#60ACF7', color: '#60ACF7',
}) })
Metacode.create({ Metacode.create({
name: 'Location', name: 'Location',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_location.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_location.png',
color: '#ABD9A7', color: '#ABD9A7',
}) })
Metacode.create({ Metacode.create({
name: 'Need', name: 'Need',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_need.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_need.png',
color: '#D2A7D4', color: '#D2A7D4',
}) })
Metacode.create({ Metacode.create({
name: 'Open', name: 'Open',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_openissue.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_openissue.png',
color: '#9BBF71', color: '#9BBF71',
}) })
Metacode.create({ Metacode.create({
name: 'Opportunity', name: 'Opportunity',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_opportunity.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_opportunity.png',
color: '#889F64', color: '#889F64',
}) })
Metacode.create({ Metacode.create({
name: 'Person', name: 'Person',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_person.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_person.png',
color: '#DE925F', color: '#DE925F',
}) })
Metacode.create({ Metacode.create({
name: 'Platform', name: 'Platform',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_platform.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_platform.png',
color: '#21C8FE', color: '#21C8FE',
}) })
Metacode.create({ Metacode.create({
name: 'Problem', name: 'Problem',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_problem.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_problem.png',
color: '#99CFC4', color: '#99CFC4',
}) })
Metacode.create({ Metacode.create({
name: 'Resource', name: 'Resource',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_resource.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_resource.png',
color: '#C98C63', color: '#C98C63',
}) })
Metacode.create({ Metacode.create({
name: 'Role', name: 'Role',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_role.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_role.png',
color: '#A8595D', color: '#A8595D',
}) })
Metacode.create({ Metacode.create({
name: 'Task', name: 'Task',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_task.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_task.png',
color: '#3397C4', color: '#3397C4',
}) })
Metacode.create({ Metacode.create({
name: 'Trajectory', name: 'Trajectory',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_trajectory.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_trajectory.png',
color: '#D3AA4C', color: '#D3AA4C',
}) })
Metacode.create({ Metacode.create({
name: 'Argument', name: 'Argument',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_argument.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_argument.png',
color: '#7FAEFD', color: '#7FAEFD',
}) })
Metacode.create({ Metacode.create({
name: 'Con', name: 'Con',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_con.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_con.png',
color: '#CF7C74', color: '#CF7C74',
}) })
Metacode.create({ Metacode.create({
name: 'Subject', name: 'Subject',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_subject.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_subject.png',
color: '#8293D8', color: '#8293D8',
}) })
Metacode.create({ Metacode.create({
name: 'Decision', name: 'Decision',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_decision.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_decision.png',
color: '#CCA866', color: '#CCA866',
}) })
Metacode.create({ Metacode.create({
name: 'Event', name: 'Event',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_event.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_event.png',
color: '#F5854B', color: '#F5854B',
}) })
Metacode.create({ Metacode.create({
name: 'Example', name: 'Example',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_example.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_example.png',
color: '#618C61', color: '#618C61',
}) })
Metacode.create({ Metacode.create({
name: 'Experience', name: 'Experience',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_experience.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_experience.png',
color: '#BE995F', color: '#BE995F',
}) })
Metacode.create({ Metacode.create({
name: 'Feedback', name: 'Feedback',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_feedback.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_feedback.png',
color: '#54A19D', color: '#54A19D',
}) })
Metacode.create({ Metacode.create({
name: 'Aim', name: 'Aim',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_aim.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_aim.png',
color: '#B0B0B0', color: '#B0B0B0',
}) })
Metacode.create({ Metacode.create({
name: 'Good', name: 'Good',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_goodpractice.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_goodpractice.png',
color: '#BD9E86', color: '#BD9E86',
}) })
Metacode.create({ Metacode.create({
name: 'Idea', name: 'Idea',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_idea.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_idea.png',
color: '#C4BC5E', color: '#C4BC5E',
}) })
Metacode.create({ Metacode.create({
name: 'List', name: 'List',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_list.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_list.png',
color: '#B7A499', color: '#B7A499',
}) })
Metacode.create({ Metacode.create({
name: 'Media', name: 'Media',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_media.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_media.png',
color: '#6D94CC', color: '#6D94CC',
}) })
Metacode.create({ Metacode.create({
name: 'Metamap', name: 'Metamap',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_metamap.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_metamap.png',
color: '#AEA9FD', color: '#AEA9FD',
}) })
Metacode.create({ Metacode.create({
name: 'Model', name: 'Model',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_model.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_model.png',
color: '#B385BA', color: '#B385BA',
}) })
Metacode.create({ Metacode.create({
name: 'Note', name: 'Note',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_note.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_note.png',
color: '#A389A1', color: '#A389A1',
}) })
Metacode.create({ Metacode.create({
name: 'Perspective', name: 'Perspective',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_perspective.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_perspective.png',
color: '#2EB6CC', color: '#2EB6CC',
}) })
Metacode.create({ Metacode.create({
name: 'Pro', name: 'Pro',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_pro.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_pro.png',
color: '#89B879', color: '#89B879',
}) })
Metacode.create({ Metacode.create({
name: 'Project', name: 'Project',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_project.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_project.png',
color: '#85A050', color: '#85A050',
}) })
Metacode.create({ Metacode.create({
name: 'Question', name: 'Question',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_question.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_question.png',
color: '#5CB3B3', color: '#5CB3B3',
}) })
Metacode.create({ Metacode.create({
name: 'Reference', name: 'Reference',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_reference.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_reference.png',
color: '#A7A7A7', color: '#A7A7A7',
}) })
Metacode.create({ Metacode.create({
name: 'Research', name: 'Research',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_research.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_research.png',
color: '#CD8E89', color: '#CD8E89',
}) })
Metacode.create({ Metacode.create({
name: 'Status', name: 'Status',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_status.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_status.png',
color: '#EFA7C0', color: '#EFA7C0',
}) })
Metacode.create({ Metacode.create({
name: 'Tool', name: 'Tool',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_tool.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_tool.png',
color: '#828282', color: '#828282',
}) })
Metacode.create({ Metacode.create({
name: 'Wildcard', name: 'Wildcard',
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_wildcard.png', manual_icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_wildcard.png',
color: '#73C7DE', color: '#73C7DE',
}) })
## END METACODES ## END METACODES

View file

@ -55,7 +55,8 @@ RSpec.describe MetacodesController, type: :controller do
describe 'PUT #update' do describe 'PUT #update' do
context 'with valid params' do context 'with valid params' do
let(:new_attributes) do let(:new_attributes) do
{ icon: 'https://newimages.ca/cool-image.jpg', { manual_icon: 'https://newimages.ca/cool-image.jpg',
aws_icon: nil,
color: '#ffffff', color: '#ffffff',
name: 'Cognition' } name: 'Cognition' }
end end

View file

@ -1,7 +1,8 @@
FactoryGirl.define do FactoryGirl.define do
factory :metacode do factory :metacode do
sequence(:name) { |n| "Cool Metacode ##{n}" } sequence(:name) { |n| "Cool Metacode ##{n}" }
icon 'https://images.com/image.png' manual_icon 'https://images.com/image.png'
aws_icon nil
color '#cccccc' color '#cccccc'
end end
end end