bhf 0.4.20 → 0.4.21
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/bhf/entries_controller.rb +10 -0
- data/app/helpers/bhf/application_helper.rb +4 -0
- data/app/views/bhf/entries/form/embeds_many/_static.haml +1 -1
- data/app/views/bhf/entries/form/embeds_one/_static.haml +1 -1
- data/app/views/bhf/pages/_platform.haml +4 -2
- data/config/locales/de.yml +4 -0
- data/config/locales/en.yml +4 -0
- data/config/routes.rb +17 -11
- data/lib/bhf/platform.rb +5 -1
- data/lib/engine.rb +4 -0
- data/vendor/assets/images/bhf/pictos.png +0 -0
- data/vendor/assets/stylesheets/bhf/application.css.sass +14 -0
- metadata +12 -12
@@ -45,6 +45,16 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
45
45
|
render :edit, r_settings
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
def duplicate
|
50
|
+
new_record = @object.dup
|
51
|
+
new_record.after_bhf_duplicate(@object) if new_record.respond_to?(:after_bhf_duplicate)
|
52
|
+
if new_record.save
|
53
|
+
redirect_to(bhf_page_url(@platform.page_name, anchor: "#{@platform.name}_platform"), notice: set_message('duplicate.success', @model))
|
54
|
+
else
|
55
|
+
redirect_to(bhf_page_url(@platform.page_name, anchor: "#{@platform.name}_platform"), notice: set_message('duplicate.error', @model))
|
56
|
+
end
|
57
|
+
end
|
48
58
|
|
49
59
|
def sort
|
50
60
|
return unless @platform.sortable
|
@@ -9,6 +9,10 @@ module Bhf
|
|
9
9
|
t("bhf.helpers.entry.models.#{platform.model_name}.new", platform_name: platform.title_singular, default: t('bhf.helpers.entry.new')).html_safe
|
10
10
|
end
|
11
11
|
|
12
|
+
def duplicate_t(platform)
|
13
|
+
t("bhf.helpers.entry.models.#{platform.model_name}.duplicate", platform_name: platform.title_singular, default: t('bhf.helpers.entry.duplicate')).html_safe
|
14
|
+
end
|
15
|
+
|
12
16
|
def edit_t(platform)
|
13
17
|
t("bhf.helpers.entry.models.#{platform.model_name}.edit", platform_name: platform.title_singular, default: t('bhf.helpers.entry.edit')).html_safe
|
14
18
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
%li
|
7
7
|
= link_to_if field.link, ref_object.to_bhf_s, edit_bhf_entry_embed_path(field.link || 0, f.object, ref_object), class: :quick_edit
|
8
8
|
- if field.link
|
9
|
-
= link_to '×'.html_safe, bhf_entry_embed_path(field.link, f.object, ref_object), method: :delete, class: :delete, remote: true, confirm: t('bhf.helpers.promts.confirm')
|
9
|
+
= link_to '×'.html_safe, bhf_entry_embed_path(field.link, f.object, ref_object), method: :delete, class: :delete, remote: true, data: {confirm: t('bhf.helpers.promts.confirm')}
|
10
10
|
|
11
11
|
- if field.link
|
12
12
|
= link_to '+', new_bhf_entry_embed_path(field.link, f.object), class: 'add_field quick_edit'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
- if ref_object
|
7
7
|
= link_to_if field.link, ref_object.to_bhf_s, edit_bhf_entry_embed_path(field.link || 0, f.object, ref_object), class: :quick_edit
|
8
8
|
- if field.link
|
9
|
-
= link_to '×'.html_safe, bhf_entry_embed_path(field.link, f.object, ref_object), method: :delete, class: :delete, remote: true, confirm: t('bhf.helpers.promts.confirm')
|
9
|
+
= link_to '×'.html_safe, bhf_entry_embed_path(field.link, f.object, ref_object), method: :delete, class: :delete, remote: true, data: {confirm: t('bhf.helpers.promts.confirm')}
|
10
10
|
|
11
11
|
- if field.link
|
12
12
|
= link_to '+', new_bhf_entry_embed_path(field.link, f.object), class: "add_field quick_edit #{('hide' if ref_object)}"
|
@@ -44,11 +44,13 @@
|
|
44
44
|
- render(partial: "bhf/pages/macro/#{column.field.macro}/#{column.field.display_type}", locals: {column: column, object: object})
|
45
45
|
= link_to_if !has_link?(column.field.overwrite_display_type), a.html_safe, (platform.custom_link ? custom_link : edit_link), class: ('quick_edit' unless platform.custom_link)
|
46
46
|
|
47
|
-
%td.action
|
47
|
+
%td.action{class: (:wider if platform.show_duplicate && !platform.hide_edit && !platform.hide_delete)}
|
48
|
+
- if platform.show_duplicate
|
49
|
+
= link_to duplicate_t(platform), duplicate_bhf_entry_path(platform.name, object), class: 'duplicate', method: :post
|
48
50
|
- unless platform.hide_edit
|
49
51
|
= link_to edit_t(platform), edit_link, class: 'edit'
|
50
52
|
- unless platform.hide_delete
|
51
|
-
= link_to delete_t(platform), bhf_entry_path(platform.name, object), method: :delete, remote: true, class: :delete, confirm: t('bhf.helpers.promts.confirm')
|
53
|
+
= link_to delete_t(platform), bhf_entry_path(platform.name, object), method: :delete, remote: true, class: :delete, data: {confirm: t('bhf.helpers.promts.confirm')}
|
52
54
|
- else
|
53
55
|
%td.no_entries{colspan: platform.columns_count}
|
54
56
|
= t 'bhf.pagination.info', name_zero: platform.title, count: 0
|
data/config/locales/de.yml
CHANGED
@@ -11,6 +11,7 @@ de:
|
|
11
11
|
entry:
|
12
12
|
show: "%{platform_name} anzeigen"
|
13
13
|
new: "%{platform_name} anlegen"
|
14
|
+
duplicate: "%{platform_name} duplizieren"
|
14
15
|
edit: "%{platform_name} editieren"
|
15
16
|
delete: "%{platform_name} löschen"
|
16
17
|
empty: Leer
|
@@ -55,6 +56,9 @@ de:
|
|
55
56
|
activerecord:
|
56
57
|
notices:
|
57
58
|
messages:
|
59
|
+
duplicate:
|
60
|
+
success: "%{model} wurde erfolgreich dupliziert"
|
61
|
+
error: "%{model} Fehler"
|
58
62
|
create:
|
59
63
|
success: "%{model} wurde erfolgreich erstellt"
|
60
64
|
error: "%{model} Fehler"
|
data/config/locales/en.yml
CHANGED
@@ -14,6 +14,7 @@ en:
|
|
14
14
|
entry:
|
15
15
|
new: "New %{platform_name}"
|
16
16
|
show: "Show %{platform_name}"
|
17
|
+
duplicate: "Duplicate %{platform_name}"
|
17
18
|
edit: "Edit %{platform_name}"
|
18
19
|
delete: "Delete %{platform_name}"
|
19
20
|
empty: Empty
|
@@ -68,6 +69,9 @@ en:
|
|
68
69
|
activerecord:
|
69
70
|
notices:
|
70
71
|
messages:
|
72
|
+
duplicate:
|
73
|
+
success: "%{model} was duplicated successfuly"
|
74
|
+
error: "%{model} error"
|
71
75
|
create:
|
72
76
|
success: "%{model} was created successfuly"
|
73
77
|
error: "%{model} error"
|
data/config/routes.rb
CHANGED
@@ -1,17 +1,23 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
resources :
|
11
|
-
|
3
|
+
Bhf::Engine.config.routes = lambda do
|
4
|
+
namespace :bhf, path: Bhf::Engine.config.mount_at do
|
5
|
+
root to: 'application#index'
|
6
|
+
|
7
|
+
get 'page/:page', to: 'pages#show', as: :page
|
8
|
+
|
9
|
+
scope ':platform' do
|
10
|
+
resources :entries, except: [:index] do
|
11
|
+
put :sort, on: :collection
|
12
|
+
|
13
|
+
resources :embed_entries, except: [:index, :show], as: :embed
|
14
|
+
post :duplicate, on: :member
|
15
|
+
end
|
12
16
|
end
|
13
|
-
end
|
14
17
|
|
18
|
+
end
|
15
19
|
end
|
16
|
-
|
20
|
+
|
21
|
+
Bhf::Engine.config.routes.call unless Bhf::Engine.config.remove_default_routes
|
22
|
+
|
17
23
|
end
|
data/lib/bhf/platform.rb
CHANGED
@@ -146,8 +146,12 @@ module Bhf
|
|
146
146
|
table_options 'hide_edit'
|
147
147
|
end
|
148
148
|
|
149
|
+
def show_duplicate
|
150
|
+
table_options 'show_duplicate'
|
151
|
+
end
|
152
|
+
|
149
153
|
def hide_delete
|
150
|
-
table_options
|
154
|
+
table_options 'hide_delete'
|
151
155
|
end
|
152
156
|
|
153
157
|
def custom_link
|
data/lib/engine.rb
CHANGED
Binary file
|
@@ -293,6 +293,7 @@ table.data_table
|
|
293
293
|
a
|
294
294
|
display: block
|
295
295
|
padding: 5px 3px
|
296
|
+
&.duplicate,
|
296
297
|
&.edit,
|
297
298
|
&.delete
|
298
299
|
padding: 0
|
@@ -304,6 +305,12 @@ table.data_table
|
|
304
305
|
background: url(pictos.png) no-repeat
|
305
306
|
&.clicked
|
306
307
|
background: url(small_ajax_loader.gif) no-repeat center center
|
308
|
+
&.duplicate
|
309
|
+
width: 24px
|
310
|
+
&.duplicate
|
311
|
+
background-position: -348px 0
|
312
|
+
&:active
|
313
|
+
background-position: -348px -101px
|
307
314
|
&.edit
|
308
315
|
&:active
|
309
316
|
background-position: 0 -101px
|
@@ -325,6 +332,10 @@ table.data_table
|
|
325
332
|
color: $w1
|
326
333
|
box-shadow: inset 0 1px 0 $b2, inset 0 2px 0 rgba(#fff, 0.4)
|
327
334
|
border-color: #EAEAEA
|
335
|
+
.duplicate
|
336
|
+
background-position: -348px -50px
|
337
|
+
&:hover
|
338
|
+
background-position: -348px -100px
|
328
339
|
.edit
|
329
340
|
background-position: 0 -50px
|
330
341
|
&:hover
|
@@ -337,6 +348,7 @@ table.data_table
|
|
337
348
|
background-position: -94px -50px
|
338
349
|
&:hover
|
339
350
|
background-position: -94px -100px
|
351
|
+
.duplicate,
|
340
352
|
.edit,
|
341
353
|
.delete
|
342
354
|
&.clicked
|
@@ -369,6 +381,8 @@ table.data_table
|
|
369
381
|
width: 30px
|
370
382
|
.action
|
371
383
|
width: 54px
|
384
|
+
&.wider
|
385
|
+
width: 88px
|
372
386
|
|
373
387
|
|
374
388
|
.default_input
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bhf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.21
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-13 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70115423646940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70115423646940
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: kaminari
|
27
|
-
requirement: &
|
27
|
+
requirement: &70115423646460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.12.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70115423646460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: haml-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70115423645980 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.3.4
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70115423645980
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sass-rails
|
49
|
-
requirement: &
|
49
|
+
requirement: &70115423645500 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.1.4
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70115423645500
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mootools-rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &70115423508020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 1.0.1
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70115423508020
|
69
69
|
description: Gets you there on time
|
70
70
|
email: anton.pawlik@gmail.com
|
71
71
|
executables: []
|