modify metacodes to instead have two fields, and validate that only one is present. Manual icons can be entered through rake tasks or on the rails console or in db seed
This commit is contained in:
parent
295534e4ab
commit
40cd1ebb5c
8 changed files with 116 additions and 83 deletions
|
@ -5,9 +5,6 @@ class MetacodesController < ApplicationController
|
|||
# GET /metacodes.json
|
||||
def index
|
||||
@metacodes = Metacode.order("name").all
|
||||
@metacodes.map do |metacode|
|
||||
metacode.icon = ActionController::Base.helpers.asset_path(metacode.icon)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -73,6 +70,6 @@ class MetacodesController < ApplicationController
|
|||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def metacode_params
|
||||
params.require(:metacode).permit(:id, :name, :icon, :color)
|
||||
params.require(:metacode).permit(:id, :name, :aws_icon, :manual_icon, :color)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,14 +3,34 @@ class Metacode < ActiveRecord::Base
|
|||
has_many :metacode_sets, :through => :in_metacode_sets
|
||||
has_many :topics
|
||||
|
||||
# This method associates the attribute ":icon" with a file attachment
|
||||
has_attached_file :icon, :styles => {
|
||||
# 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 :icon, :content_type => /\Aimage\/.*\Z/
|
||||
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)
|
||||
return true if user.settings.metacodes.include? self.id.to_s
|
||||
|
@ -21,4 +41,23 @@ class Metacode < ActiveRecord::Base
|
|||
return true if self.metacode_sets.include? metacode_set
|
||||
return false
|
||||
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
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :icon %>
|
||||
<%= f.file_field :icon %>
|
||||
<%= f.hidden_field :manual_icon, value: nil %>
|
||||
<%= f.file_field :aws_icon %>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
<div class="field">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<% @metacodes.each do |metacode| %>
|
||||
<tr>
|
||||
<td><%= metacode.name %></td>
|
||||
<td class="iconURL"><%= asset_path metacode.icon %></td>
|
||||
<td class="iconURL"><%= metacode.icon %></td>
|
||||
<% if metacode.color %>
|
||||
<td class="iconColor" style="background-color: <%= metacode.color %>">
|
||||
<%= metacode.color %>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<% else %>
|
||||
<td></td>
|
||||
<% 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>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class AddAttachmentIconToMetacodes < ActiveRecord::Migration
|
||||
def change
|
||||
change_table :metacodes do |t|
|
||||
t.rename :icon, :old_icon
|
||||
t.attachment :icon
|
||||
t.rename :icon, :manual_icon
|
||||
t.attachment :aws_icon
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
27
db/schema.rb
27
db/schema.rb
|
@ -63,6 +63,19 @@ ActiveRecord::Schema.define(version: 20160223061711) do
|
|||
|
||||
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|
|
||||
t.string "name"
|
||||
t.text "desc"
|
||||
|
@ -76,14 +89,14 @@ ActiveRecord::Schema.define(version: 20160223061711) do
|
|||
|
||||
create_table "metacodes", force: :cascade do |t|
|
||||
t.text "name"
|
||||
t.string "old_icon"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "manual_icon"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "color"
|
||||
t.string "icon_file_name"
|
||||
t.string "icon_content_type"
|
||||
t.integer "icon_file_size"
|
||||
t.datetime "icon_updated_at"
|
||||
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
|
||||
|
||||
create_table "synapses", force: :cascade do |t|
|
||||
|
|
94
db/seeds.rb
94
db/seeds.rb
|
@ -24,283 +24,283 @@ User.new({
|
|||
## METACODES
|
||||
Metacode.create({
|
||||
name: 'Action',
|
||||
icon_file_name: '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'
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Activity',
|
||||
icon_file_name: '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'
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Catalyst',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Closed',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Process',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Future',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Group',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Implication',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Insight',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Intention',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Knowledge',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Location',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Need',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Open',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Opportunity',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Person',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Platform',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Problem',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Resource',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Role',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Task',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Trajectory',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Argument',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Con',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Subject',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Decision',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Event',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Example',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Experience',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Feedback',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Aim',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Good',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Idea',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'List',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Media',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Metamap',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Model',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Note',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Perspective',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Pro',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Project',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Question',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Reference',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Research',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Status',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Tool',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Wildcard',
|
||||
icon_file_name: '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',
|
||||
})
|
||||
## END METACODES
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
namespace :aws do
|
||||
desc 'migrate metacodes to aws'
|
||||
task metacode_icon_migrate: :environment do
|
||||
def no_aws(msg)
|
||||
Rails.logger.error msg
|
||||
end
|
||||
|
||||
no_aws 'You need to configure S3_BUCKET' unless ENV['S3_BUCKET'].present?
|
||||
no_aws 'You need to configure AWS_ACCESS_KEY_ID' unless ENV['AWS_ACCESS_KEY_ID'].present?
|
||||
no_aws 'You need to configure AWS_SECRET_ACCESS_KEY' unless ENV['AWS_SECRET_ACCESS_KEY'].present?
|
||||
|
||||
Metacode.find_each do |metacode|
|
||||
metacode.icon = metacode.old_icon
|
||||
metacode.save
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue