parent
8e8c578c65
commit
e77aae007b
@ -0,0 +1,303 @@ |
||||
#-- encoding: UTF-8 |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
module BasicData |
||||
class FlatColorSeeder < Seeder |
||||
def seed_data! |
||||
Color.transaction do |
||||
data.each do |attributes| |
||||
Color.create(attributes) |
||||
end |
||||
end |
||||
end |
||||
|
||||
def applicable? |
||||
Color.where(name: %w(blanchedalmond Razzmatazz)).empty? |
||||
end |
||||
|
||||
def not_applicable_message |
||||
'Skipping flat colors as there are already some configured' |
||||
end |
||||
|
||||
## |
||||
def data |
||||
[ |
||||
{ name: 'alice blue', hexcode: '#E4F1FE' }, |
||||
{ name: 'aliceblue', hexcode: '#F0F8FF' }, |
||||
{ name: 'antiquewhite', hexcode: '#FAEBD7' }, |
||||
{ name: 'aqua island', hexcode: '#A2DED0' }, |
||||
{ name: 'aqua', hexcode: '#00FFFF' }, |
||||
{ name: 'aquamarine', hexcode: '#7FFFD4' }, |
||||
{ name: 'azure', hexcode: '#F0FFFF' }, |
||||
{ name: 'beige', hexcode: '#F5F5DC' }, |
||||
{ name: 'bisque', hexcode: '#FFE4C4' }, |
||||
{ name: 'black', hexcode: '#000000' }, |
||||
{ name: 'blanchedalmond', hexcode: '#FFEBCD' }, |
||||
{ name: 'blue', hexcode: '#0000FF' }, |
||||
{ name: 'blueviolet', hexcode: '#8A2BE2' }, |
||||
{ name: 'brown', hexcode: '#A52A2A' }, |
||||
{ name: 'burlywood', hexcode: '#DEB887' }, |
||||
{ name: 'burnt orange', hexcode: '#D35400' }, |
||||
{ name: 'buttercup', hexcode: '#F39C12' }, |
||||
{ name: 'cabaret', hexcode: '#D2527F' }, |
||||
{ name: 'cadetblue', hexcode: '#5F9EA0' }, |
||||
{ name: 'california', hexcode: '#F89406' }, |
||||
{ name: 'cape honey', hexcode: '#FDE3A7' }, |
||||
{ name: 'cararra', hexcode: '#F2F1EF' }, |
||||
{ name: 'caribbean green', hexcode: '#03C9A9' }, |
||||
{ name: 'casablanca', hexcode: '#F4B350' }, |
||||
{ name: 'cascade', hexcode: '#95A5A6' }, |
||||
{ name: 'chambray', hexcode: '#3A539B' }, |
||||
{ name: 'chartreuse', hexcode: '#7FFF00' }, |
||||
{ name: 'chestnut rose', hexcode: '#D24D57' }, |
||||
{ name: 'chocolate', hexcode: '#D2691E' }, |
||||
{ name: 'cinnabar', hexcode: '#E74C3C' }, |
||||
{ name: 'confetti', hexcode: '#E9D460' }, |
||||
{ name: 'coral', hexcode: '#FF7F50' }, |
||||
{ name: 'cornflowerblue', hexcode: '#6495ED' }, |
||||
{ name: 'cornsilk', hexcode: '#FFF8DC' }, |
||||
{ name: 'cream can', hexcode: '#F5D76E' }, |
||||
{ name: 'crimson', hexcode: '#DC143C' }, |
||||
{ name: 'crusta', hexcode: '#F2784B' }, |
||||
{ name: 'curious blue', hexcode: '#3498DB' }, |
||||
{ name: 'cyan', hexcode: '#00FFFF' }, |
||||
{ name: 'dark sea green', hexcode: '#90C695' }, |
||||
{ name: 'darkblue', hexcode: '#00008B' }, |
||||
{ name: 'darkcyan', hexcode: '#008B8B' }, |
||||
{ name: 'darkgoldenrod', hexcode: '#B8860B' }, |
||||
{ name: 'darkgray', hexcode: '#A9A9A9' }, |
||||
{ name: 'darkgreen', hexcode: '#006400' }, |
||||
{ name: 'darkgrey', hexcode: '#A9A9A9' }, |
||||
{ name: 'darkkhaki', hexcode: '#BDB76B' }, |
||||
{ name: 'darkmagenta', hexcode: '#8B008B' }, |
||||
{ name: 'darkolivegreen', hexcode: '#556B2F' }, |
||||
{ name: 'darkorange', hexcode: '#FF8C00' }, |
||||
{ name: 'darkorchid', hexcode: '#9932CC' }, |
||||
{ name: 'darkred', hexcode: '#8B0000' }, |
||||
{ name: 'darksalmon', hexcode: '#E9967A' }, |
||||
{ name: 'darkseagreen', hexcode: '#8FBC8F' }, |
||||
{ name: 'darkslateblue', hexcode: '#483D8B' }, |
||||
{ name: 'darkslategray', hexcode: '#2F4F4F' }, |
||||
{ name: 'darkslategrey', hexcode: '#2F4F4F' }, |
||||
{ name: 'darkturquoise', hexcode: '#00CED1' }, |
||||
{ name: 'darkviolet', hexcode: '#9400D3' }, |
||||
{ name: 'deeppink', hexcode: '#FF1493' }, |
||||
{ name: 'deepskyblue', hexcode: '#00BFFF' }, |
||||
{ name: 'dimgray', hexcode: '#696969' }, |
||||
{ name: 'dimgrey', hexcode: '#696969' }, |
||||
{ name: 'dodger blue', hexcode: '#19B5FE' }, |
||||
{ name: 'dodgerblue', hexcode: '#1E90FF' }, |
||||
{ name: 'downy', hexcode: '#65C6BB' }, |
||||
{ name: 'ebony clay', hexcode: '#22313F' }, |
||||
{ name: 'ecstasy', hexcode: '#F9690E' }, |
||||
{ name: 'edward', hexcode: '#ABB7B7' }, |
||||
{ name: 'emerald', hexcode: '#3FC380' }, |
||||
{ name: 'eucalyptus', hexcode: '#26A65B' }, |
||||
{ name: 'fire bush', hexcode: '#EB9532' }, |
||||
{ name: 'firebrick', hexcode: '#B22222' }, |
||||
{ name: 'flamingo', hexcode: '#EF4836' }, |
||||
{ name: 'floralwhite', hexcode: '#FFFAF0' }, |
||||
{ name: 'forestgreen', hexcode: '#228B22' }, |
||||
{ name: 'fountain blue', hexcode: '#5C97BF' }, |
||||
{ name: 'fuchsia', hexcode: '#FF00FF' }, |
||||
{ name: 'gainsboro', hexcode: '#DCDCDC' }, |
||||
{ name: 'gallery', hexcode: '#EEEEEE' }, |
||||
{ name: 'ghostwhite', hexcode: '#F8F8FF' }, |
||||
{ name: 'gold', hexcode: '#FFD700' }, |
||||
{ name: 'goldenrod', hexcode: '#DAA520' }, |
||||
{ name: 'gossip', hexcode: '#87D37C' }, |
||||
{ name: 'gray', hexcode: '#808080' }, |
||||
{ name: 'green haze', hexcode: '#019875' }, |
||||
{ name: 'green', hexcode: '#008000' }, |
||||
{ name: 'greenyellow', hexcode: '#ADFF2F' }, |
||||
{ name: 'grey', hexcode: '#808080' }, |
||||
{ name: 'hoki', hexcode: '#67809F' }, |
||||
{ name: 'honey flower', hexcode: '#674172' }, |
||||
{ name: 'honeydew', hexcode: '#F0FFF0' }, |
||||
{ name: 'hotpink', hexcode: '#FF69B4' }, |
||||
{ name: 'humming bird', hexcode: '#C5EFF7' }, |
||||
{ name: 'indianred', hexcode: '#CD5C5C' }, |
||||
{ name: 'indigo', hexcode: '#4B0082' }, |
||||
{ name: 'iron', hexcode: '#DADFE1' }, |
||||
{ name: 'ivory', hexcode: '#FFFFF0' }, |
||||
{ name: 'jacksons purple', hexcode: '#1F3A93' }, |
||||
{ name: 'jade', hexcode: '#00B16A' }, |
||||
{ name: 'jaffa', hexcode: '#F27935' }, |
||||
{ name: 'jelly bean', hexcode: '#2574A9' }, |
||||
{ name: 'jordy blue', hexcode: '#89C4F4' }, |
||||
{ name: 'jungle green', hexcode: '#26C281' }, |
||||
{ name: 'khaki', hexcode: '#F0E68C' }, |
||||
{ name: 'lavender', hexcode: '#E6E6FA' }, |
||||
{ name: 'lavenderblush', hexcode: '#FFF0F5' }, |
||||
{ name: 'lawngreen', hexcode: '#7CFC00' }, |
||||
{ name: 'lemonchiffon', hexcode: '#FFFACD' }, |
||||
{ name: 'light sea green', hexcode: '#1BA39C' }, |
||||
{ name: 'light wisteria', hexcode: '#BE90D4' }, |
||||
{ name: 'lightblue', hexcode: '#ADD8E6' }, |
||||
{ name: 'lightcoral', hexcode: '#F08080' }, |
||||
{ name: 'lightcyan', hexcode: '#E0FFFF' }, |
||||
{ name: 'lightgoldenrodyellow', hexcode: '#FAFAD2' }, |
||||
{ name: 'lightgray', hexcode: '#D3D3D3' }, |
||||
{ name: 'lightgreen', hexcode: '#90EE90' }, |
||||
{ name: 'lightgrey', hexcode: '#D3D3D3' }, |
||||
{ name: 'lightning yellow', hexcode: '#F5AB35' }, |
||||
{ name: 'lightpink', hexcode: '#FFB6C1' }, |
||||
{ name: 'lightsalmon', hexcode: '#FFA07A' }, |
||||
{ name: 'lightseagreen', hexcode: '#20B2AA' }, |
||||
{ name: 'lightskyblue', hexcode: '#87CEFA' }, |
||||
{ name: 'lightslategray', hexcode: '#778899' }, |
||||
{ name: 'lightslategrey', hexcode: '#778899' }, |
||||
{ name: 'lightsteelblue', hexcode: '#B0C4DE' }, |
||||
{ name: 'lightyellow', hexcode: '#FFFFE0' }, |
||||
{ name: 'lime', hexcode: '#00FF00' }, |
||||
{ name: 'limegreen', hexcode: '#32CD32' }, |
||||
{ name: 'linen', hexcode: '#FAF0E6' }, |
||||
{ name: 'lynch', hexcode: '#6C7A89' }, |
||||
{ name: 'madang', hexcode: '#C8F7C5' }, |
||||
{ name: 'madison', hexcode: '#2C3E50' }, |
||||
{ name: 'magenta', hexcode: '#FF00FF' }, |
||||
{ name: 'malibu', hexcode: '#6BB9F0' }, |
||||
{ name: 'maroon', hexcode: '#800000' }, |
||||
{ name: 'medium aquamarine', hexcode: '#66CC99' }, |
||||
{ name: 'medium purple', hexcode: '#BF55EC' }, |
||||
{ name: 'medium turquoise', hexcode: '#4ECDC4' }, |
||||
{ name: 'mediumaquamarine', hexcode: '#66CDAA' }, |
||||
{ name: 'mediumblue', hexcode: '#0000CD' }, |
||||
{ name: 'mediumorchid', hexcode: '#BA55D3' }, |
||||
{ name: 'mediumpurple', hexcode: '#9370DB' }, |
||||
{ name: 'mediumseagreen', hexcode: '#3CB371' }, |
||||
{ name: 'mediumslateblue', hexcode: '#7B68EE' }, |
||||
{ name: 'mediumspringgreen', hexcode: '#00FA9A' }, |
||||
{ name: 'mediumturquoise', hexcode: '#48D1CC' }, |
||||
{ name: 'mediumvioletred', hexcode: '#C71585' }, |
||||
{ name: 'midnightblue', hexcode: '#191970' }, |
||||
{ name: 'ming', hexcode: '#336E7B' }, |
||||
{ name: 'mintcream', hexcode: '#F5FFFA' }, |
||||
{ name: 'mistyrose', hexcode: '#FFE4E1' }, |
||||
{ name: 'moccasin', hexcode: '#FFE4B5' }, |
||||
{ name: 'monza', hexcode: '#CF000F' }, |
||||
{ name: 'mountain meadow', hexcode: '#1BBC9B' }, |
||||
{ name: 'navajowhite', hexcode: '#FFDEAD' }, |
||||
{ name: 'navy', hexcode: '#000080' }, |
||||
{ name: 'new york pink', hexcode: '#E08283' }, |
||||
{ name: 'niagara 1', hexcode: '#2ABB9B' }, |
||||
{ name: 'niagara', hexcode: '#16A085' }, |
||||
{ name: 'observatory', hexcode: '#049372' }, |
||||
{ name: 'ocean green', hexcode: '#4DAF7C' }, |
||||
{ name: 'old brick', hexcode: '#96281B' }, |
||||
{ name: 'oldlace', hexcode: '#FDF5E6' }, |
||||
{ name: 'olive', hexcode: '#808000' }, |
||||
{ name: 'olivedrab', hexcode: '#6B8E23' }, |
||||
{ name: 'orange', hexcode: '#FFA500' }, |
||||
{ name: 'orangered', hexcode: '#FF4500' }, |
||||
{ name: 'orchid', hexcode: '#DA70D6' }, |
||||
{ name: 'palegoldenrod', hexcode: '#EEE8AA' }, |
||||
{ name: 'palegreen', hexcode: '#98FB98' }, |
||||
{ name: 'paleturquoise', hexcode: '#AFEEEE' }, |
||||
{ name: 'palevioletred', hexcode: '#DB7093' }, |
||||
{ name: 'papayawhip', hexcode: '#FFEFD5' }, |
||||
{ name: 'peachpuff', hexcode: '#FFDAB9' }, |
||||
{ name: 'peru', hexcode: '#CD853F' }, |
||||
{ name: 'pickled bluewood', hexcode: '#34495E' }, |
||||
{ name: 'picton blue 2', hexcode: '#22A7F0' }, |
||||
{ name: 'picton blue', hexcode: '#59ABE3' }, |
||||
{ name: 'pink', hexcode: '#FFC0CB' }, |
||||
{ name: 'plum', hexcode: '#913D88' }, |
||||
{ name: 'plum', hexcode: '#DDA0DD' }, |
||||
{ name: 'pomegranate', hexcode: '#F22613' }, |
||||
{ name: 'porcelain', hexcode: '#ECF0F1' }, |
||||
{ name: 'powderblue', hexcode: '#B0E0E6' }, |
||||
{ name: 'pumice', hexcode: '#D2D7D3' }, |
||||
{ name: 'purple', hexcode: '#800080' }, |
||||
{ name: 'radical red', hexcode: '#F62459' }, |
||||
{ name: 'razzmatazz', hexcode: '#DB0A5B' }, |
||||
{ name: 'rebeccapurple', hexcode: '#663399' }, |
||||
{ name: 'red', hexcode: '#FF0000' }, |
||||
{ name: 'ripe lemon', hexcode: '#F7CA18' }, |
||||
{ name: 'riptide', hexcode: '#86E2D5' }, |
||||
{ name: 'rosybrown', hexcode: '#BC8F8F' }, |
||||
{ name: 'royal blue', hexcode: '#4183D7' }, |
||||
{ name: 'royalblue', hexcode: '#4169E1' }, |
||||
{ name: 'saddlebrown', hexcode: '#8B4513' }, |
||||
{ name: 'saffron', hexcode: '#F4D03F' }, |
||||
{ name: 'salem', hexcode: '#1E824C' }, |
||||
{ name: 'salmon', hexcode: '#FA8072' }, |
||||
{ name: 'san marino', hexcode: '#446CB3' }, |
||||
{ name: 'sandstorm', hexcode: '#F9BF3B' }, |
||||
{ name: 'sandybrown', hexcode: '#F4A460' }, |
||||
{ name: 'sea buckthorn', hexcode: '#EB974E' }, |
||||
{ name: 'seagreen', hexcode: '#2E8B57' }, |
||||
{ name: 'seance', hexcode: '#9A12B3' }, |
||||
{ name: 'seashell', hexcode: '#FFF5EE' }, |
||||
{ name: 'shakespeare', hexcode: '#52B3D9' }, |
||||
{ name: 'shamrock', hexcode: '#2ECC71' }, |
||||
{ name: 'sienna', hexcode: '#A0522D' }, |
||||
{ name: 'silver sand', hexcode: '#BDC3C7' }, |
||||
{ name: 'silver tree', hexcode: '#68C3A3' }, |
||||
{ name: 'silver', hexcode: '#BFBFBF' }, |
||||
{ name: 'silver', hexcode: '#C0C0C0' }, |
||||
{ name: 'skyblue', hexcode: '#87CEEB' }, |
||||
{ name: 'slateblue', hexcode: '#6A5ACD' }, |
||||
{ name: 'slategray', hexcode: '#708090' }, |
||||
{ name: 'slategrey', hexcode: '#708090' }, |
||||
{ name: 'snow', hexcode: '#FFFAFA' }, |
||||
{ name: 'snuff', hexcode: '#DCC6E0' }, |
||||
{ name: 'soft red', hexcode: '#EC644B' }, |
||||
{ name: 'spray', hexcode: '#81CFE0' }, |
||||
{ name: 'springgreen', hexcode: '#00FF7F' }, |
||||
{ name: 'steel blue', hexcode: '#4B77BE' }, |
||||
{ name: 'steelblue', hexcode: '#4682B4' }, |
||||
{ name: 'studio', hexcode: '#8E44AD' }, |
||||
{ name: 'summer sky', hexcode: '#1E8BC3' }, |
||||
{ name: 'sunglo', hexcode: '#E26A6A' }, |
||||
{ name: 'sunset orange', hexcode: '#F64747' }, |
||||
{ name: 'tahiti gold', hexcode: '#E87E04' }, |
||||
{ name: 'tall poppy', hexcode: '#C0392B' }, |
||||
{ name: 'tan', hexcode: '#D2B48C' }, |
||||
{ name: 'teal', hexcode: '#008080' }, |
||||
{ name: 'thistle', hexcode: '#D8BFD8' }, |
||||
{ name: 'thunderbird', hexcode: '#D91E18' }, |
||||
{ name: 'tomato', hexcode: '#FF6347' }, |
||||
{ name: 'turquoise', hexcode: '#36D7B7' }, |
||||
{ name: 'turquoise', hexcode: '#40E0D0' }, |
||||
{ name: 'valencia', hexcode: '#D64541' }, |
||||
{ name: 'violet', hexcode: '#EE82EE' }, |
||||
{ name: 'wax flower', hexcode: '#F1A9A0' }, |
||||
{ name: 'wheat', hexcode: '#F5DEB3' }, |
||||
{ name: 'white smoke', hexcode: '#ECECEC' }, |
||||
{ name: 'white', hexcode: '#FFFFFF' }, |
||||
{ name: 'whitesmoke', hexcode: '#F5F5F5' }, |
||||
{ name: 'wisteria', hexcode: '#9B59B6' }, |
||||
{ name: 'wistful', hexcode: '#AEA8D3' }, |
||||
{ name: 'yellow', hexcode: '#FFFF00' }, |
||||
{ name: 'yellowgreen', hexcode: '#9ACD32' }, |
||||
{ name: 'zest', hexcode: '#E67E22' } |
||||
] |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,58 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License version 3. |
||||
|
||||
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
Copyright (C) 2010-2013 the ChiliProject Team |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program; if not, write to the Free Software |
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
|
||||
See docs/COPYRIGHT.rdoc for more details. |
||||
|
||||
++#%> |
||||
|
||||
<% html_title l(:label_administration), l("timelines.admin_menu.colors") %> |
||||
|
||||
<%= toolbar title: l('timelines.admin_menu.colors') do %> |
||||
<li class="toolbar-item"> |
||||
<%= link_to new_color_path, |
||||
{ class: 'button -alt-highlight', |
||||
aria: {label: l('timelines.new_color')}, |
||||
title: l('timelines.new_color')} do %> |
||||
<%= op_icon('button--icon icon-add') %> |
||||
<span class="button--text"><%= t('activerecord.attributes.type.color') %></span> |
||||
<% end %> |
||||
</li> |
||||
<% end %> |
||||
|
||||
<% if @colors.any? %> |
||||
<div class="color--preview-patch-field"> |
||||
<% @colors.each do |color| %> |
||||
<%= content_tag :div, |
||||
class: 'color--preview-patch', |
||||
style: "background-color: #{color.hexcode}" do %> |
||||
<%= link_to color.name, |
||||
edit_color_path(color), |
||||
class: color.bright? ? '-bright' : '-dark' %> |
||||
<% end %> |
||||
<% end %> |
||||
</div> |
||||
<% else %> |
||||
<%= no_results_box(action_url: new_color_path, display_action: true) unless @colors.any? %> |
||||
<% end %> |
@ -1,111 +0,0 @@ |
||||
<%#-- copyright |
||||
OpenProject is a project management system. |
||||
Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License version 3. |
||||
|
||||
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
Copyright (C) 2010-2013 the ChiliProject Team |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program; if not, write to the Free Software |
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
|
||||
See docs/COPYRIGHT.rdoc for more details. |
||||
|
||||
++#%> |
||||
|
||||
<% html_title l(:label_administration), l("timelines.admin_menu.colors") %> |
||||
|
||||
<%= toolbar title: l('timelines.admin_menu.colors') do %> |
||||
<li class="toolbar-item"> |
||||
<%= link_to new_color_path, |
||||
{ class: 'button -alt-highlight', |
||||
aria: {label: l('timelines.new_color')}, |
||||
title: l('timelines.new_color')} do %> |
||||
<%= op_icon('button--icon icon-add') %> |
||||
<span class="button--text"><%= t('activerecord.attributes.type.color') %></span> |
||||
<% end %> |
||||
</li> |
||||
<% end %> |
||||
|
||||
<% if @colors.any? %> |
||||
<div class="generic-table--container"> |
||||
<div class="generic-table--results-container"> |
||||
<table class="generic-table"> |
||||
<colgroup> |
||||
<col highlight-col> |
||||
<col highlight-col> |
||||
<col highlight-col> |
||||
<col> |
||||
</colgroup> |
||||
<thead> |
||||
<tr> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<span> |
||||
<%= Type.human_attribute_name(:name) %> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<span> |
||||
<%= Type.human_attribute_name(:color) %> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
<th> |
||||
<div class="generic-table--sort-header-outer"> |
||||
<div class="generic-table--sort-header"> |
||||
<span> |
||||
<%=l(:button_sort)%> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</th> |
||||
<th><div class="generic-table--empty-header"></div></th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<% @colors.each do |color| %> |
||||
<tr id="color-<%= color.id %>"> |
||||
<td class="timelines-color-name"><%= link_to(h(color.name), edit_color_path(color)) %></td> |
||||
<td class="timelines-color-hexcode"> |
||||
<%= colored_text(color) %> |
||||
<%= icon_for_color(color, class: 'standalone') %> |
||||
</td> |
||||
<td class="timelines-color-reorder"><%= reorder_links('color', {action: 'move', id: color}) %></td> |
||||
<td class="timelines-color-actions buttons"> |
||||
<%= link_to(confirm_destroy_color_path(color), |
||||
class: 'icon icon-delete') do %> |
||||
<%= l(:button_delete) %> |
||||
<span class="hidden-for-sighted"><%=h color.name %></span> |
||||
<% end %> |
||||
</td> |
||||
</tr> |
||||
<% end %> |
||||
</tbody> |
||||
</table> |
||||
|
||||
</div> |
||||
</div> |
||||
<% else %> |
||||
<%= no_results_box(action_url: new_color_path, display_action: true) %> |
||||
<% end %> |
@ -0,0 +1,14 @@ |
||||
class RenamePlanningElemntTypeColorsToColors < ActiveRecord::Migration[5.1] |
||||
def up |
||||
rename_table :planning_element_type_colors, :colors |
||||
remove_column :colors, :position |
||||
end |
||||
|
||||
def down |
||||
rename_table :colors, :planning_element_type_colors |
||||
|
||||
change_table :planning_element_type_colors do |
||||
t.integer :position, default: 1, null: true |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,22 @@ |
||||
<ng-content style="display:none"></ng-content> |
||||
|
||||
<a class="colors-autocompleter--selected-value" |
||||
role="button" |
||||
tabindex="0" |
||||
(click)="editUnlessMulti()" |
||||
*ngIf="selectedColor"> |
||||
<span class="color--preview" |
||||
[style.background-color]="selectedColor"></span> |
||||
|
||||
<span class="color--text-preview" |
||||
[textContent]="selectedItem.label" |
||||
[style.background-color]="bgColor" |
||||
[style.color]="fgColor"></span> |
||||
</a> |
||||
|
||||
<input |
||||
[hidden]="selectedItems.length" |
||||
type="text" |
||||
class="form--input -autocomplete" |
||||
[attr.placeholder]="placeholderText"> |
||||
|
@ -0,0 +1,139 @@ |
||||
// -- copyright
|
||||
// OpenProject is a project management system.
|
||||
// Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License version 3.
|
||||
//
|
||||
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
|
||||
// Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
// Copyright (C) 2010-2013 the ChiliProject Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
// See doc/COPYRIGHT.rdoc for more details.
|
||||
// ++
|
||||
|
||||
import {Component, ElementRef, Inject, Input, OnInit} from '@angular/core'; |
||||
import {opUiComponentsModule} from 'core-app/angular-modules'; |
||||
import {downgradeComponent} from '@angular/upgrade/static'; |
||||
import {I18nToken} from 'core-app/angular4-transition-utils'; |
||||
import {AutocompleteSelectDecorationComponent} from 'core-components/common/autocomplete-select-decoration/autocomplete-select-decoration.component'; |
||||
import {ColorContrast} from 'core-components/a11y/color-contrast.functions'; |
||||
|
||||
interface ColorAutocompleteItem { |
||||
id:number; |
||||
label:string; |
||||
color:string; |
||||
value:string; |
||||
} |
||||
|
||||
@Component({ |
||||
template: require('!!raw-loader!./colors-autocompleter.component.html'), |
||||
selector: 'colors-autocompleter', |
||||
}) |
||||
|
||||
export class ColorsAutocompleter extends AutocompleteSelectDecorationComponent<ColorAutocompleteItem> { |
||||
|
||||
protected getItems() { |
||||
_.each(this.$select.find('option'), option => { |
||||
let $option = jQuery(option); |
||||
let text = $option.text(); |
||||
|
||||
let item = { |
||||
id: $option.prop('value'), |
||||
color: $option.data('color'), |
||||
label: text, |
||||
value: text |
||||
}; |
||||
|
||||
this.allItems.push(item); |
||||
|
||||
if ($option.prop('selected')) { |
||||
this.selectedItems.push(item); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public get selectedColorIsBright():boolean { |
||||
return !!this.selectedColor && ColorContrast.tooBrightForWhite(this.selectedColor); |
||||
} |
||||
|
||||
public get fgColor() { |
||||
if (this.selectedColor) { |
||||
return ColorContrast.getColorPatch(this.selectedColor).fg; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public get bgColor() { |
||||
if (this.selectedColor) { |
||||
return ColorContrast.getColorPatch(this.selectedColor).bg; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public get selectedItem():ColorAutocompleteItem|undefined { |
||||
return this.selectedItems.length > 0 ? this.selectedItems[0] : undefined; |
||||
} |
||||
|
||||
public get selectedColor():string|undefined { |
||||
return this.selectedItem ? this.selectedItem.color : undefined; |
||||
} |
||||
|
||||
protected setupAutocompleter() { |
||||
super.setupAutocompleter(); |
||||
|
||||
const autocompleter = this.$input.autocomplete('instance'); |
||||
const menu = autocompleter.menu; |
||||
|
||||
this.$input.focus(function() { |
||||
autocompleter.search(); |
||||
}); |
||||
|
||||
autocompleter._renderItem = function(this:any, ul:JQuery, item:ColorAutocompleteItem) { |
||||
const term = this.element.val(); |
||||
const patch = ColorContrast.getColorPatch(item.color); |
||||
|
||||
const colorSquare = jQuery('<span>') |
||||
.addClass('color--preview') |
||||
.css('background-color', item.color); |
||||
|
||||
const colorText = jQuery('<span>') |
||||
.addClass('color--text-preview') |
||||
.css('color', patch.fg) |
||||
.css('background-color', patch.bg) |
||||
.text(item.label); |
||||
|
||||
const div = jQuery('<div>') |
||||
.append(colorSquare) |
||||
.append(colorText) |
||||
.addClass('ui-menu-item-wrapper'); |
||||
|
||||
const element = jQuery('<li>') |
||||
.append(div) |
||||
.appendTo(ul); |
||||
|
||||
return element; |
||||
}; |
||||
} |
||||
} |
||||
|
||||
opUiComponentsModule.directive( |
||||
'colorsAutocompleter', |
||||
downgradeComponent({component: ColorsAutocompleter}) |
||||
); |
Loading…
Reference in new issue