refinerycms-banners 1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/admin/banners_controller.rb +8 -0
- data/app/controllers/banners_controller.rb +30 -0
- data/app/models/banner.rb +8 -0
- data/app/views/admin/banners/_actions.html.erb +28 -0
- data/app/views/admin/banners/_banner.html.erb +18 -0
- data/app/views/admin/banners/_banners.html.erb +2 -0
- data/app/views/admin/banners/_form.html.erb +29 -0
- data/app/views/admin/banners/_records.html.erb +18 -0
- data/app/views/admin/banners/_sortable_list.html.erb +7 -0
- data/app/views/admin/banners/edit.html.erb +1 -0
- data/app/views/admin/banners/index.html.erb +10 -0
- data/app/views/admin/banners/new.html.erb +1 -0
- data/app/views/banners/index.html.erb +11 -0
- data/app/views/banners/show.html.erb +33 -0
- data/config/locales/fr.yml +25 -0
- data/config/locales/lolcat.yml +25 -0
- data/config/locales/nb.yml +21 -0
- data/config/locales/nl.yml +21 -0
- data/config/locales/ru.yml +25 -0
- data/config/routes.rb +11 -0
- data/lib/generators/refinerycms_banners_generator.rb +6 -0
- data/lib/refinerycms-banners.rb +30 -0
- data/lib/tasks/banners.rake +13 -0
- metadata +86 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class BannersController < ApplicationController
|
|
2
|
+
|
|
3
|
+
before_filter :find_all_banners
|
|
4
|
+
before_filter :find_page
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
|
8
|
+
# by swapping @page for @banner in the line below:
|
|
9
|
+
present(@page)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def show
|
|
13
|
+
@banner = Banner.find(params[:id])
|
|
14
|
+
|
|
15
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
|
16
|
+
# by swapping @page for @banner in the line below:
|
|
17
|
+
present(@page)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def find_all_banners
|
|
23
|
+
@banners = Banner.order('position ASC')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def find_page
|
|
27
|
+
@page = Page.where(:link_url => "/banners").first
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<ul>
|
|
2
|
+
<% if Admin::BannersController.searchable? %>
|
|
3
|
+
<li>
|
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
|
5
|
+
:locals => {
|
|
6
|
+
:url => admin_banners_path
|
|
7
|
+
} %>
|
|
8
|
+
</li>
|
|
9
|
+
<% end %>
|
|
10
|
+
<li>
|
|
11
|
+
<%= link_to t('.create_new'), new_admin_banner_path,
|
|
12
|
+
:class => "add_icon" %>
|
|
13
|
+
</li>
|
|
14
|
+
<% if !searching? and Admin::BannersController.sortable? and Banner.count > 1 %>
|
|
15
|
+
<li>
|
|
16
|
+
<%= link_to t('.reorder', :what => "Banners"),
|
|
17
|
+
admin_banners_path,
|
|
18
|
+
:id => "reorder_action",
|
|
19
|
+
:class => "reorder_icon" %>
|
|
20
|
+
|
|
21
|
+
<%= link_to t('.reorder_done', :what => "Banners"),
|
|
22
|
+
admin_banners_path,
|
|
23
|
+
:id => "reorder_action_done",
|
|
24
|
+
:style => "display: none;",
|
|
25
|
+
:class => "reorder_icon" %>
|
|
26
|
+
</li>
|
|
27
|
+
<% end %>
|
|
28
|
+
</ul>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(banner) -%>">
|
|
2
|
+
<span class='title'>
|
|
3
|
+
<%= banner.link %>
|
|
4
|
+
<span class="preview"> </span>
|
|
5
|
+
</span>
|
|
6
|
+
<span class='actions'>
|
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), banner_path(banner),
|
|
8
|
+
:title => t('.view_live_html'),
|
|
9
|
+
:target => "_blank" %>
|
|
10
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_banner_path(banner),
|
|
11
|
+
:title => t('.edit') %>
|
|
12
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_banner_path(banner),
|
|
13
|
+
:class => "cancel confirm-delete",
|
|
14
|
+
:title => t('.delete'),
|
|
15
|
+
:confirm => t('message', :scope => 'shared.admin.delete', :title => banner.link),
|
|
16
|
+
:method => :delete %>
|
|
17
|
+
</span>
|
|
18
|
+
</li>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<%= form_for [:admin, @banner] do |f| -%>
|
|
2
|
+
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
|
3
|
+
:object => @banner,
|
|
4
|
+
:include_object_name => true
|
|
5
|
+
} %>
|
|
6
|
+
|
|
7
|
+
<div class='field'>
|
|
8
|
+
<%= f.label :image -%>
|
|
9
|
+
<%= render :partial => "/shared/admin/image_picker", :locals => {
|
|
10
|
+
:f => f,
|
|
11
|
+
:field => :image_id,
|
|
12
|
+
:image => @banner.image,
|
|
13
|
+
:toggle_image_display => false
|
|
14
|
+
} %>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class='field'>
|
|
18
|
+
<%= f.label :link -%>
|
|
19
|
+
<%= f.text_field :link -%>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<%= render :partial => "/shared/admin/form_actions",
|
|
23
|
+
:locals => {
|
|
24
|
+
:f => f,
|
|
25
|
+
:continue_editing => false,
|
|
26
|
+
:delete_title => t('delete', :scope => 'admin.banners.banner'),
|
|
27
|
+
:delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @banner.link)
|
|
28
|
+
} %>
|
|
29
|
+
<% end -%>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% if searching? %>
|
|
2
|
+
<h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
|
|
3
|
+
<% end %>
|
|
4
|
+
<% if @banners.any? %>
|
|
5
|
+
<div class='pagination_container'>
|
|
6
|
+
<%= render :partial => 'banners' %>
|
|
7
|
+
</div>
|
|
8
|
+
<% else %>
|
|
9
|
+
<p>
|
|
10
|
+
<% unless searching? %>
|
|
11
|
+
<strong>
|
|
12
|
+
<%= t('.no_items_yet') %>
|
|
13
|
+
</strong>
|
|
14
|
+
<% else %>
|
|
15
|
+
<%= t('no_results', :scope => 'shared.admin.search') %>
|
|
16
|
+
<% end %>
|
|
17
|
+
</p>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<ul id='sortable_list'>
|
|
2
|
+
<%= render :partial => 'banner', :collection => @banners %>
|
|
3
|
+
</ul>
|
|
4
|
+
<%= render :partial => "/shared/admin/sortable_list",
|
|
5
|
+
:locals => {
|
|
6
|
+
:continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
|
|
7
|
+
} %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render :partial => "form" %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<section id='records'>
|
|
2
|
+
<%= render :partial => 'records' %>
|
|
3
|
+
</section>
|
|
4
|
+
<aside id='actions'>
|
|
5
|
+
<%= render :partial => 'actions' %>
|
|
6
|
+
</aside>
|
|
7
|
+
<%= render :partial => '/shared/admin/make_sortable',
|
|
8
|
+
:locals => {
|
|
9
|
+
:tree => false
|
|
10
|
+
} if !searching? and Admin::BannersController.sortable? and Banner.count > 1 %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render :partial => "form" %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<% content_for :body_content_title do %>
|
|
2
|
+
<%= @banner.link %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<% content_for :body_content_left do %>
|
|
6
|
+
<section>
|
|
7
|
+
<h1>Image</h1>
|
|
8
|
+
<p>
|
|
9
|
+
<%= image_fu @banner.image, nil %>
|
|
10
|
+
</p>
|
|
11
|
+
</section>
|
|
12
|
+
<section>
|
|
13
|
+
<h1>Link</h1>
|
|
14
|
+
<p>
|
|
15
|
+
<%=raw @banner.link %>
|
|
16
|
+
</p>
|
|
17
|
+
</section>
|
|
18
|
+
<% end %>
|
|
19
|
+
|
|
20
|
+
<% content_for :body_content_right do %>
|
|
21
|
+
<aside>
|
|
22
|
+
<h2><%= t('.other') %></h2>
|
|
23
|
+
<ul id="banners">
|
|
24
|
+
<% @banners.each do |banner| %>
|
|
25
|
+
<li>
|
|
26
|
+
<%= link_to banner.link, banner_path(banner) %>
|
|
27
|
+
</li>
|
|
28
|
+
<% end %>
|
|
29
|
+
</ul>
|
|
30
|
+
</aside>
|
|
31
|
+
<% end %>
|
|
32
|
+
|
|
33
|
+
<%= render :partial => "/shared/content_page" %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
fr:
|
|
2
|
+
shared:
|
|
3
|
+
admin:
|
|
4
|
+
image_picker:
|
|
5
|
+
image: image
|
|
6
|
+
plugins:
|
|
7
|
+
banners:
|
|
8
|
+
title: Banners
|
|
9
|
+
admin:
|
|
10
|
+
banners:
|
|
11
|
+
actions:
|
|
12
|
+
create_new: Créer un(e) nouve(au/l/lle) Banner
|
|
13
|
+
reorder: Réordonner les Banners
|
|
14
|
+
reorder_done: Fin de réordonnancement des Banners
|
|
15
|
+
records:
|
|
16
|
+
title: Banners
|
|
17
|
+
sorry_no_results: "Désolé ! Aucun résultat."
|
|
18
|
+
no_items_yet: 'Il n''y a actuellement aucun(e) Banner. Cliquer sur "Créer un(e) nouve(au/l/lle) Banner" pour créer votre premi(er/ère) banner.'
|
|
19
|
+
banner:
|
|
20
|
+
view_live_html: Voir ce(t/tte) banner <br/><em>(Ouvre une nouvelle fenêtre)</em>
|
|
21
|
+
edit: Modifier ce(t/tte) banner
|
|
22
|
+
delete: Supprimer définitivement ce(t/tte) banner
|
|
23
|
+
banners:
|
|
24
|
+
show:
|
|
25
|
+
other: Autres Banners
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
lolcat:
|
|
2
|
+
shared:
|
|
3
|
+
admin:
|
|
4
|
+
image_picker:
|
|
5
|
+
image: IMAGE
|
|
6
|
+
plugins:
|
|
7
|
+
banners:
|
|
8
|
+
title: Banners
|
|
9
|
+
admin:
|
|
10
|
+
banners:
|
|
11
|
+
actions:
|
|
12
|
+
create_new: CREATE NEW Banner
|
|
13
|
+
reorder: REORDR Banners
|
|
14
|
+
reorder_done: DUN REORDERIN Banners
|
|
15
|
+
records:
|
|
16
|
+
title: Banners
|
|
17
|
+
sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
|
|
18
|
+
no_items_yet: THAR R NO Banners YET. CLICK "CREATE NEW Banner" 2 ADD UR FURST banner.
|
|
19
|
+
banner:
|
|
20
|
+
view_live_html: VIEW DIS banner LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
|
|
21
|
+
edit: EDIT DIS banner
|
|
22
|
+
delete: REMOOV DIS banner FOREVR
|
|
23
|
+
banners:
|
|
24
|
+
show:
|
|
25
|
+
other: OTHR Banners
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
nb:
|
|
2
|
+
plugins:
|
|
3
|
+
banners:
|
|
4
|
+
title: Banners
|
|
5
|
+
admin:
|
|
6
|
+
banners:
|
|
7
|
+
actions:
|
|
8
|
+
create_new: Lag en ny Banner
|
|
9
|
+
reorder: Endre rekkefølgen på Banners
|
|
10
|
+
reorder_done: Ferdig å endre rekkefølgen Banners
|
|
11
|
+
records:
|
|
12
|
+
title: Banners
|
|
13
|
+
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
|
14
|
+
no_items_yet: Det er ingen Banners enda. Klikk på "Lag en ny Banner" for å legge til din første banner.
|
|
15
|
+
banner:
|
|
16
|
+
view_live_html: Vis hvordan denne banner ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
|
17
|
+
edit: Rediger denne banner
|
|
18
|
+
delete: Fjern denne banner permanent
|
|
19
|
+
banners:
|
|
20
|
+
show:
|
|
21
|
+
other: Andre Banners
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
nl:
|
|
2
|
+
plugins:
|
|
3
|
+
banners:
|
|
4
|
+
title: Banners
|
|
5
|
+
admin:
|
|
6
|
+
banners:
|
|
7
|
+
actions:
|
|
8
|
+
create_new: Maak een nieuwe Banner
|
|
9
|
+
reorder: Wijzig de volgorde van de Banners
|
|
10
|
+
reorder_done: Klaar met het wijzingen van de volgorde van de Banners
|
|
11
|
+
records:
|
|
12
|
+
title: Banners
|
|
13
|
+
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
|
14
|
+
no_items_yet: Er zijn nog geen Banners. Druk op 'Maak een nieuwe Banner' om de eerste aan te maken.
|
|
15
|
+
banner:
|
|
16
|
+
view_live_html: Bekijk deze banner op de website <br/><em>(opent een nieuw venster)</em>
|
|
17
|
+
edit: Bewerk deze banner
|
|
18
|
+
delete: Verwijder deze banner voor eeuwig
|
|
19
|
+
banners:
|
|
20
|
+
show:
|
|
21
|
+
other: Andere Banners
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
ru:
|
|
2
|
+
shared:
|
|
3
|
+
admin:
|
|
4
|
+
image_picker:
|
|
5
|
+
image: изображение
|
|
6
|
+
plugins:
|
|
7
|
+
banners:
|
|
8
|
+
title: Баннер
|
|
9
|
+
admin:
|
|
10
|
+
banners:
|
|
11
|
+
actions:
|
|
12
|
+
create_new: Добавить новый баннер
|
|
13
|
+
reorder: Отсортировать баннеры
|
|
14
|
+
reorder_done: Сортировка закончена
|
|
15
|
+
records:
|
|
16
|
+
title: Баннеры
|
|
17
|
+
sorry_no_results: Ничего не найдено.
|
|
18
|
+
no_items_yet: Еще нет ни одного баннера.
|
|
19
|
+
banner:
|
|
20
|
+
view_live_html: Просмотреть баннер на главной
|
|
21
|
+
edit: Редактировать баннер
|
|
22
|
+
delete: Удалить баннер
|
|
23
|
+
banners:
|
|
24
|
+
show:
|
|
25
|
+
other: Другие баннеры
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
::Refinery::Application.routes.draw do
|
|
2
|
+
resources :banners, :only => [:index, :show]
|
|
3
|
+
|
|
4
|
+
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
|
5
|
+
resources :banners, :except => :show do
|
|
6
|
+
collection do
|
|
7
|
+
post :update_positions
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'refinerycms-base'
|
|
2
|
+
|
|
3
|
+
module Refinery
|
|
4
|
+
module Banners
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
attr_accessor :root
|
|
8
|
+
def root
|
|
9
|
+
@root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Engine < Rails::Engine
|
|
14
|
+
initializer "static assets" do |app|
|
|
15
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
config.after_initialize do
|
|
19
|
+
Refinery::Plugin.register do |plugin|
|
|
20
|
+
plugin.name = "banners"
|
|
21
|
+
plugin.pathname = root
|
|
22
|
+
plugin.activity = {
|
|
23
|
+
:class => Banner,
|
|
24
|
+
:title => 'link'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: refinerycms-banners
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 15
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 1
|
|
8
|
+
- 0
|
|
9
|
+
version: "1.0"
|
|
10
|
+
platform: ruby
|
|
11
|
+
authors:
|
|
12
|
+
- Maxim Tsaplin
|
|
13
|
+
autorequire:
|
|
14
|
+
bindir: bin
|
|
15
|
+
cert_chain: []
|
|
16
|
+
|
|
17
|
+
date: 2012-02-06 00:00:00 Z
|
|
18
|
+
dependencies: []
|
|
19
|
+
|
|
20
|
+
description: Ruby on Rails Banners engine for Refinery CMS
|
|
21
|
+
email:
|
|
22
|
+
executables: []
|
|
23
|
+
|
|
24
|
+
extensions: []
|
|
25
|
+
|
|
26
|
+
extra_rdoc_files: []
|
|
27
|
+
|
|
28
|
+
files:
|
|
29
|
+
- lib/tasks/banners.rake
|
|
30
|
+
- lib/refinerycms-banners.rb
|
|
31
|
+
- lib/generators/refinerycms_banners_generator.rb
|
|
32
|
+
- config/routes.rb
|
|
33
|
+
- config/locales/nb.yml
|
|
34
|
+
- config/locales/nl.yml
|
|
35
|
+
- config/locales/lolcat.yml
|
|
36
|
+
- config/locales/fr.yml
|
|
37
|
+
- config/locales/ru.yml
|
|
38
|
+
- app/models/banner.rb
|
|
39
|
+
- app/views/banners/show.html.erb
|
|
40
|
+
- app/views/banners/index.html.erb
|
|
41
|
+
- app/views/admin/banners/_banner.html.erb
|
|
42
|
+
- app/views/admin/banners/edit.html.erb
|
|
43
|
+
- app/views/admin/banners/_records.html.erb
|
|
44
|
+
- app/views/admin/banners/_sortable_list.html.erb
|
|
45
|
+
- app/views/admin/banners/new.html.erb
|
|
46
|
+
- app/views/admin/banners/_actions.html.erb
|
|
47
|
+
- app/views/admin/banners/_form.html.erb
|
|
48
|
+
- app/views/admin/banners/_banners.html.erb
|
|
49
|
+
- app/views/admin/banners/index.html.erb
|
|
50
|
+
- app/controllers/admin/banners_controller.rb
|
|
51
|
+
- app/controllers/banners_controller.rb
|
|
52
|
+
homepage:
|
|
53
|
+
licenses: []
|
|
54
|
+
|
|
55
|
+
post_install_message:
|
|
56
|
+
rdoc_options: []
|
|
57
|
+
|
|
58
|
+
require_paths:
|
|
59
|
+
- lib
|
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
|
+
none: false
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
hash: 3
|
|
66
|
+
segments:
|
|
67
|
+
- 0
|
|
68
|
+
version: "0"
|
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
|
+
none: false
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
hash: 3
|
|
75
|
+
segments:
|
|
76
|
+
- 0
|
|
77
|
+
version: "0"
|
|
78
|
+
requirements: []
|
|
79
|
+
|
|
80
|
+
rubyforge_project:
|
|
81
|
+
rubygems_version: 1.8.10
|
|
82
|
+
signing_key:
|
|
83
|
+
specification_version: 3
|
|
84
|
+
summary: Banners engine for Refinery CMS
|
|
85
|
+
test_files: []
|
|
86
|
+
|