spree_essentials_jn 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +143 -0
- data/Gemfile +6 -0
- data/LICENSE +27 -0
- data/README.md +292 -0
- data/Rakefile +10 -0
- data/Versionfile +8 -0
- data/app/assets/images/admin/icons/pages.png +0 -0
- data/app/assets/images/blog/rss.png +0 -0
- data/app/assets/images/markitup/bg-container.png +0 -0
- data/app/assets/images/markitup/bg-editor.png +0 -0
- data/app/assets/images/markitup/bg-picker.png +0 -0
- data/app/assets/images/markitup/bold.png +0 -0
- data/app/assets/images/markitup/code.png +0 -0
- data/app/assets/images/markitup/h1.png +0 -0
- data/app/assets/images/markitup/h2.png +0 -0
- data/app/assets/images/markitup/h3.png +0 -0
- data/app/assets/images/markitup/h4.png +0 -0
- data/app/assets/images/markitup/h5.png +0 -0
- data/app/assets/images/markitup/h6.png +0 -0
- data/app/assets/images/markitup/handle.png +0 -0
- data/app/assets/images/markitup/image-picker.png +0 -0
- data/app/assets/images/markitup/italic.png +0 -0
- data/app/assets/images/markitup/link.png +0 -0
- data/app/assets/images/markitup/list-bullet.png +0 -0
- data/app/assets/images/markitup/list-numeric.png +0 -0
- data/app/assets/images/markitup/menu.png +0 -0
- data/app/assets/images/markitup/more-tag.png +0 -0
- data/app/assets/images/markitup/picture.png +0 -0
- data/app/assets/images/markitup/preview.png +0 -0
- data/app/assets/images/markitup/quotes.png +0 -0
- data/app/assets/images/markitup/submenu.png +0 -0
- data/app/assets/javascripts/admin/date.js +145 -0
- data/app/assets/javascripts/admin/jquery.autodate.js +110 -0
- data/app/assets/javascripts/admin/jquery.markitup.js +593 -0
- data/app/assets/javascripts/admin/markdown.set.js +95 -0
- data/app/assets/javascripts/admin/spree_essentials.js +1 -0
- data/app/assets/stylesheets/admin/markitup.css.erb +283 -0
- data/app/assets/stylesheets/admin/spree_essentials.css +3 -0
- data/app/controllers/spree/admin/markdown_controller.rb +7 -0
- data/app/controllers/spree/admin/uploads_controller.rb +16 -0
- data/app/helpers/spree/admin/spree_essentials_helper.rb +31 -0
- data/app/models/spree/asset_decorator.rb +7 -0
- data/app/models/spree/upload.rb +36 -0
- data/app/overrides/admin/spree_essentials.rb +13 -0
- data/app/validators/datetime_validator.rb +6 -0
- data/app/views/spree/admin/shared/_contents_sub_menu.html.erb +10 -0
- data/app/views/spree/admin/shared/_contents_tab.html.erb +1 -0
- data/app/views/spree/admin/uploads/_form.html.erb +8 -0
- data/app/views/spree/admin/uploads/edit.html.erb +23 -0
- data/app/views/spree/admin/uploads/index.html.erb +68 -0
- data/app/views/spree/admin/uploads/new.html.erb +22 -0
- data/app/views/spree/admin/uploads/picker.html.erb +11 -0
- data/config/locales/en.yml +45 -0
- data/config/locales/it.yml +40 -0
- data/config/locales/pl.yml +44 -0
- data/config/locales/ru.yml +41 -0
- data/config/routes.rb +7 -0
- data/lib/generators/spree_essentials/install_generator.rb +22 -0
- data/lib/spree_essentials.rb +28 -0
- data/lib/spree_essentials/engine.rb +25 -0
- data/lib/spree_essentials/testing/integration_case.rb +72 -0
- data/lib/spree_essentials/testing/test_helper.rb +30 -0
- data/lib/spree_essentials/version.rb +3 -0
- data/spree_essentials.gemspec +34 -0
- data/test/dummy_hooks/after_migrate.rb.sample +1 -0
- data/test/dummy_hooks/before_migrate.rb +30 -0
- data/test/dummy_hooks/templates/admin/all.css +3 -0
- data/test/dummy_hooks/templates/admin/all.js +1 -0
- data/test/dummy_hooks/templates/spree_user_error_fix.rb +3 -0
- data/test/dummy_hooks/templates/store/all.css +3 -0
- data/test/dummy_hooks/templates/store/all.js +1 -0
- data/test/dummy_hooks/templates/store/screen.css +749 -0
- data/test/integration/spree/admin/extension_integration_test.rb +50 -0
- data/test/integration/spree/admin/markdown_integration_test.rb +50 -0
- data/test/integration/spree/admin/upload_integration_test.rb +85 -0
- data/test/integration_test_helper.rb +2 -0
- data/test/spree_essential_example/README.md +3 -0
- data/test/spree_essential_example/app/controllers/spree/admin/examples_controller.rb +26 -0
- data/test/spree_essential_example/app/models/spree/example.rb +5 -0
- data/test/spree_essential_example/app/views/spree/admin/examples/_form.html.erb +21 -0
- data/test/spree_essential_example/app/views/spree/admin/examples/edit.html.erb +12 -0
- data/test/spree_essential_example/app/views/spree/admin/examples/index.html.erb +26 -0
- data/test/spree_essential_example/app/views/spree/admin/examples/new.html.erb +13 -0
- data/test/spree_essential_example/app/views/spree/admin/examples/show.html.erb +8 -0
- data/test/spree_essential_example/config/routes.rb +5 -0
- data/test/spree_essential_example/db/migrate/20120307043727_create_spree_examples.rb +12 -0
- data/test/spree_essential_example/lib/generators/spree_essentials/example_generator.rb +13 -0
- data/test/spree_essential_example/lib/spree_essential_example.rb +18 -0
- data/test/spree_essential_example/lib/spree_essential_example/engine.rb +21 -0
- data/test/spree_essential_example/lib/spree_essential_example/version.rb +3 -0
- data/test/spree_essential_example/spree_essential_example.gemspec +23 -0
- data/test/support/files/1.gif +0 -0
- data/test/support/files/1.jpg +0 -0
- data/test/support/files/1.png +0 -0
- data/test/support/files/2.gif +0 -0
- data/test/support/files/2.jpg +0 -0
- data/test/support/files/2.png +0 -0
- data/test/support/files/3.gif +0 -0
- data/test/support/files/3.jpg +0 -0
- data/test/support/files/3.png +0 -0
- data/test/support/files/test.pdf +0 -0
- data/test/support/files/test.zip +0 -0
- data/test/test_helper.rb +12 -0
- data/test/unit/spree/asset_test.rb +18 -0
- data/test/unit/spree/extension_test.rb +33 -0
- data/test/unit/spree/helpers/admin/spree_essentials_helper_test.rb +38 -0
- data/test/unit/spree/upload_test.rb +52 -0
- data/test/unit/validators/datetime_validator_test.rb +29 -0
- metadata +286 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
class Spree::Upload < ::Spree::Asset
|
2
|
+
|
3
|
+
attr_accessible :attachment, :alt
|
4
|
+
|
5
|
+
default_scope where(:type => "Upload") if table_exists?
|
6
|
+
|
7
|
+
validate :no_attachement_errors
|
8
|
+
|
9
|
+
has_attached_file :attachment,
|
10
|
+
:styles => Proc.new{ |clip| clip.instance.attachment_sizes },
|
11
|
+
:default_style => :medium,
|
12
|
+
:url => "/spree/uploads/:id/:style/:basename.:extension",
|
13
|
+
:path => ":rails_root/public/spree/uploads/:id/:style/:basename.:extension"
|
14
|
+
|
15
|
+
def image_content?
|
16
|
+
attachment_content_type.match(/\/(jpeg|png|gif|tiff|x-photoshop)/)
|
17
|
+
end
|
18
|
+
|
19
|
+
def attachment_sizes
|
20
|
+
if image_content?
|
21
|
+
{ :mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '800x500>' }
|
22
|
+
else
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def no_attachement_errors
|
28
|
+
if attachment_file_name.blank? || !attachment.errors.empty?
|
29
|
+
# uncomment this to get rid of the less-than-useful interrim messages
|
30
|
+
errors.clear
|
31
|
+
errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Adds the Content button to the admin tabs
|
2
|
+
Deface::Override.new(:virtual_path => "spree/layouts/admin",
|
3
|
+
:name => "spree_essential_admin_tabs",
|
4
|
+
:insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
|
5
|
+
:partial => "spree/admin/shared/contents_tab",
|
6
|
+
:disabled => false)
|
7
|
+
|
8
|
+
# Adds the contents menu. Inside the contents sub menu we ensure it's needed
|
9
|
+
Deface::Override.new(:virtual_path => "spree/layouts/admin",
|
10
|
+
:name => "spree_essential_contents_menu",
|
11
|
+
:insert_top => "#sub-menu[data-hook]",
|
12
|
+
:partial => "spree/admin/shared/contents_sub_menu",
|
13
|
+
:disabled => false)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class DatetimeValidator < ActiveModel::EachValidator
|
2
|
+
def validate_each(record, attribute, value)
|
3
|
+
date = DateTime.parse(value.to_s) rescue ArgumentError
|
4
|
+
record.errors.add(attribute, I18n.t(:invalid_date_time, :scope => [:activerecord, :errors, :messages])) if date == ArgumentError
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if inside_contents_tab? %>
|
2
|
+
<% content_for :sub_menu do %>
|
3
|
+
<ul id="sub_nav" data-hook="essentials_sub_nav">
|
4
|
+
<% SpreeEssentials.essentials.each_pair do |name, cls| %>
|
5
|
+
<%= tab *cls.sub_tab if defined?(cls.sub_tab) %>
|
6
|
+
<% end %>
|
7
|
+
<%= tab :uploads, :label => t('spree.admin.subnav.uploads') %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= contents_tab %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1><%= t('.edit_upload') %></h1>
|
2
|
+
|
3
|
+
<% if @upload.try(:errors).present? %>
|
4
|
+
<%= render 'shared/error_messages', :target => @upload %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<%= form_for([:admin, @upload], :html => { :multipart => true }) do |f| %>
|
8
|
+
<p>
|
9
|
+
<% if @upload.image_content? %>
|
10
|
+
<b><%= t('.preview') %>:</b><br/>
|
11
|
+
<%= link_to image_tag(@upload.attachment.url(:small)), @upload.attachment.url(:original) %>
|
12
|
+
<% else %>
|
13
|
+
<b><%= t('.link') %>:</b><br/>
|
14
|
+
<%= link_to @upload.attachment_file_name, @upload.attachment.url %>
|
15
|
+
<% end %>
|
16
|
+
</p>
|
17
|
+
<%= render "form", :form => f %>
|
18
|
+
</table>
|
19
|
+
<p class="form-buttons">
|
20
|
+
<%= button t("update") %>
|
21
|
+
or <%= link_to t("cancel"), admin_uploads_url, :id => "cancel_link" %>
|
22
|
+
</p>
|
23
|
+
<% end %>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
<h1><%= t('.listing_uploads') %></h1>
|
3
|
+
|
4
|
+
<table class="index">
|
5
|
+
<tr>
|
6
|
+
<th><%= t("thumbnail") %></th>
|
7
|
+
<th><%= sort_link @search, :attachment_file_name, t("upload.file_name") %></th>
|
8
|
+
<th><%= sort_link @search, :description, t("description") %></th>
|
9
|
+
<th><%= sort_link @search, :attachment_file_size, t("upload.size") %></th>
|
10
|
+
<th><%= t("action") %></th>
|
11
|
+
</tr>
|
12
|
+
|
13
|
+
<% @uploads.each do |upload| %>
|
14
|
+
<tr id="<%= dom_id(upload) %>">
|
15
|
+
<td class="thumbnail">
|
16
|
+
<% if upload.image_content? %>
|
17
|
+
<%= link_to image_tag(upload.attachment.url(:mini)), upload.attachment.url(:large) %>
|
18
|
+
<% end %>
|
19
|
+
</td>
|
20
|
+
<td><%= link_to upload.attachment_file_name, upload.attachment.url(:original) %></td>
|
21
|
+
<td><%= upload.alt %></td>
|
22
|
+
<td><%= upload.attachment_file_size.to_i / 1024 %> kb</td>
|
23
|
+
<td class="actions">
|
24
|
+
<%= link_to_with_icon('edit', t("edit"), edit_admin_upload_url(upload)) %>
|
25
|
+
|
26
|
+
<%= link_to_delete upload, {:url => admin_upload_url(upload) }%>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
</table>
|
32
|
+
|
33
|
+
<%= paginate @uploads %>
|
34
|
+
|
35
|
+
|
36
|
+
<% content_for :sidebar do %>
|
37
|
+
|
38
|
+
<div class="box">
|
39
|
+
<h3><%= t(:search) %></h3>
|
40
|
+
<%= search_form_for [ :admin, @search ] do |f| %>
|
41
|
+
<p>
|
42
|
+
<%= f.label :alt_cont, t("description") %><br />
|
43
|
+
<%= f.text_field :alt_cont, :size => 25 %>
|
44
|
+
</p>
|
45
|
+
<p><%= button t("search") %></p>
|
46
|
+
<% end %>
|
47
|
+
</div>
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<div id="images"></div>
|
51
|
+
<br/>
|
52
|
+
<p>
|
53
|
+
<%= link_to icon('add') + ' ' + t(".new_upload"), new_admin_upload_url, :id => "new_image_link" %>
|
54
|
+
</p>
|
55
|
+
|
56
|
+
<% content_for :head do %>
|
57
|
+
<script type="text/javascript">
|
58
|
+
jQuery(document).ready(function(){
|
59
|
+
|
60
|
+
jQuery('#new_image_link').click(function(event) {
|
61
|
+
event.preventDefault();
|
62
|
+
jQuery(this).hide();
|
63
|
+
jQuery.ajax({type: 'GET', url: this.href, data: ({authenticity_token: AUTH_TOKEN}), success: function(r){ jQuery('#images').html(r);} });
|
64
|
+
});
|
65
|
+
|
66
|
+
});
|
67
|
+
</script>
|
68
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h3><%= t('.new_upload') %></h3>
|
2
|
+
|
3
|
+
<% if @upload.try(:errors).present? %>
|
4
|
+
<%= render 'shared/error_messages', :target => @upload %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<%= form_for([:admin, @upload], :html => { :multipart => true }) do |form| %>
|
8
|
+
<table class="basic-table">
|
9
|
+
<%= render "form", :form => form %>
|
10
|
+
</table>
|
11
|
+
<p class="form-buttons">
|
12
|
+
<%= button t("create") %>
|
13
|
+
or <%= link_to t("cancel"), "#", :id => "cancel_link" %>
|
14
|
+
</p>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
jQuery('#cancel_link').click(function (event) {
|
19
|
+
jQuery('#new_image_link').show();
|
20
|
+
jQuery('#images').html('');
|
21
|
+
});
|
22
|
+
</script>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<ul class="picker">
|
2
|
+
<% @uploads.each do |upload| %>
|
3
|
+
<li>
|
4
|
+
<% if upload.image_content? %>
|
5
|
+
<%= link_to image_tag(upload.attachment.url(:mini)), upload.attachment.url(:original), :class => 'option image' %>
|
6
|
+
<% else %>
|
7
|
+
<%= link_to upload.attachment_file_name, upload.attachment.url(:original), :class => 'option file' %>
|
8
|
+
<% end %>
|
9
|
+
</li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
en:
|
2
|
+
|
3
|
+
successfully_created: "%{resource} has been successfully created!"
|
4
|
+
successfully_removed: "%{resource} has been successfully removed!"
|
5
|
+
successfully_updated: "%{resource} has been successfully updated!"
|
6
|
+
|
7
|
+
essentials:
|
8
|
+
parsed_with: Parsed With
|
9
|
+
|
10
|
+
activerecord:
|
11
|
+
attributes:
|
12
|
+
order:
|
13
|
+
completed_at: Completed At
|
14
|
+
errors:
|
15
|
+
messages:
|
16
|
+
invalid_date_time: is an invalid date.
|
17
|
+
|
18
|
+
upload:
|
19
|
+
model_name: Upload
|
20
|
+
file_name: File Name
|
21
|
+
size: Size
|
22
|
+
|
23
|
+
# spree hack
|
24
|
+
first_name_start: "First Name starts with"
|
25
|
+
last_name_start: "Last Name starts with"
|
26
|
+
|
27
|
+
spree:
|
28
|
+
admin:
|
29
|
+
shared:
|
30
|
+
contents_tab:
|
31
|
+
content: Content
|
32
|
+
|
33
|
+
subnav:
|
34
|
+
uploads: Uploads
|
35
|
+
|
36
|
+
uploads:
|
37
|
+
new:
|
38
|
+
new_upload: New Upload
|
39
|
+
edit:
|
40
|
+
edit_upload: Edit Upload
|
41
|
+
preview: Preview
|
42
|
+
link: Link
|
43
|
+
index:
|
44
|
+
listing_uploads: Listing Uploads
|
45
|
+
new_upload: Upload a file
|
@@ -0,0 +1,40 @@
|
|
1
|
+
it:
|
2
|
+
successfully_created: "%{resource} è stato creato con successo!"
|
3
|
+
successfully_removed: "%{resource} è stato rimosso con successo!"
|
4
|
+
successfully_updated: "%{resource} è stato aggiornato con successo!"
|
5
|
+
|
6
|
+
essentials:
|
7
|
+
parsed_with: Interpretato con
|
8
|
+
|
9
|
+
activerecord:
|
10
|
+
attributes:
|
11
|
+
order:
|
12
|
+
completed_at: Completato il
|
13
|
+
errors:
|
14
|
+
messages:
|
15
|
+
invalid_date_time: è una data non valida.
|
16
|
+
|
17
|
+
upload:
|
18
|
+
model_name: Allegato
|
19
|
+
file_name: Nome file
|
20
|
+
size: Dimensioni
|
21
|
+
|
22
|
+
spree:
|
23
|
+
admin:
|
24
|
+
shared:
|
25
|
+
contents_tab:
|
26
|
+
content: Contentuto
|
27
|
+
|
28
|
+
subnav:
|
29
|
+
uploads: Allegati
|
30
|
+
|
31
|
+
uploads:
|
32
|
+
new:
|
33
|
+
new_upload: Nuovo allegato
|
34
|
+
edit:
|
35
|
+
edit_upload: Modifica allegato
|
36
|
+
preview: Anteprima
|
37
|
+
link: Collegamento
|
38
|
+
index:
|
39
|
+
listing_uploads: Elenco allegati
|
40
|
+
new_upload: Carica un file
|
@@ -0,0 +1,44 @@
|
|
1
|
+
pl:
|
2
|
+
successfully_created: "%{resource} został pomyślnie utworzona!"
|
3
|
+
successfully_removed: "%{resource} został pomyślnie usunięta!"
|
4
|
+
successfully_updated: "%{resource} został pomyślnie zaktualizowana!"
|
5
|
+
|
6
|
+
essentials:
|
7
|
+
parsed_with: "Parsowany przez"
|
8
|
+
|
9
|
+
activerecord:
|
10
|
+
attributes:
|
11
|
+
order:
|
12
|
+
completed_at: "Ukończone w"
|
13
|
+
errors:
|
14
|
+
messages:
|
15
|
+
invalid_date_time: "jest nieprawidłową datą."
|
16
|
+
|
17
|
+
upload:
|
18
|
+
model_name: "Załączniki"
|
19
|
+
file_name: "Nazwa pliku"
|
20
|
+
size: "Rozmiar"
|
21
|
+
|
22
|
+
# spree hack
|
23
|
+
first_name_start: "Imię zaczyna się od"
|
24
|
+
last_name_start: "Nazwisko zaczyna się od"
|
25
|
+
|
26
|
+
spree:
|
27
|
+
admin:
|
28
|
+
shared:
|
29
|
+
contents_tab:
|
30
|
+
content: "Treść"
|
31
|
+
|
32
|
+
subnav:
|
33
|
+
uploads: "Załączniki"
|
34
|
+
|
35
|
+
uploads:
|
36
|
+
new:
|
37
|
+
new_upload: "Nowy załącznik"
|
38
|
+
edit:
|
39
|
+
edit_upload: "Edytuj załącznik"
|
40
|
+
preview: "Podgląd"
|
41
|
+
link: "Link"
|
42
|
+
index:
|
43
|
+
listing_uploads: "Lista załączników"
|
44
|
+
new_upload: "Prześlij plik"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
ru:
|
2
|
+
|
3
|
+
successfully_created: "%{resource} успешно создан!"
|
4
|
+
successfully_removed: "%{resource} успешно удалён!"
|
5
|
+
successfully_updated: "%{resource} успешно сохранён!"
|
6
|
+
|
7
|
+
essentials:
|
8
|
+
parsed_with: Форматирование текста
|
9
|
+
|
10
|
+
activerecord:
|
11
|
+
attributes:
|
12
|
+
order:
|
13
|
+
completed_at: Заказ оформлен
|
14
|
+
errors:
|
15
|
+
messages:
|
16
|
+
invalid_date_time: формат даты неверен.
|
17
|
+
|
18
|
+
upload:
|
19
|
+
model_name: Загрузить
|
20
|
+
file_name: Имя файла
|
21
|
+
size: Размер
|
22
|
+
|
23
|
+
spree:
|
24
|
+
admin:
|
25
|
+
shared:
|
26
|
+
contents_tab:
|
27
|
+
content: Содержимое
|
28
|
+
|
29
|
+
subnav:
|
30
|
+
uploads: Загруженные файлы
|
31
|
+
|
32
|
+
uploads:
|
33
|
+
new:
|
34
|
+
new_upload: Загрузить новый файл
|
35
|
+
edit:
|
36
|
+
edit_upload: Редактировать файл
|
37
|
+
preview: Предварительный просмотр
|
38
|
+
link: Ссылка
|
39
|
+
index:
|
40
|
+
listing_uploads: Список загруженных файлов
|
41
|
+
new_upload: Загрузить новый файл
|
data/config/routes.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module SpreeEssentials
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
desc "Installs required migrations for spree_essentials"
|
6
|
+
|
7
|
+
class_option :add_stylesheets, :type => :boolean, :default => true, :banner => 'Append spree_essentials to admin/all.css'
|
8
|
+
class_option :add_javascripts, :type => :boolean, :default => true, :banner => 'Append spree_essentials to admin/all.js'
|
9
|
+
|
10
|
+
def append_stylesheets
|
11
|
+
return unless options[:add_stylesheets]
|
12
|
+
gsub_file "app/assets/stylesheets/admin/all.css", "*/", "*= require admin/spree_essentials\n*/"
|
13
|
+
end
|
14
|
+
|
15
|
+
def append_javascripts
|
16
|
+
return unless options[:add_javascripts]
|
17
|
+
append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_essentials"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "spree_core"
|
2
|
+
require "rdiscount"
|
3
|
+
|
4
|
+
require "spree_essentials/version"
|
5
|
+
require "spree_essentials/engine"
|
6
|
+
|
7
|
+
module SpreeEssentials
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
# Stores an essential-aware extension for use later
|
12
|
+
def register(key, extension)
|
13
|
+
essentials[key] = extension
|
14
|
+
end
|
15
|
+
|
16
|
+
# Looks up an extension name
|
17
|
+
def has?(essential)
|
18
|
+
essentials.keys.include?(essential.to_sym)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns the array of essential-aware extensions
|
22
|
+
def essentials
|
23
|
+
@essentials ||= {}
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|