lipsiadmin 4.1.8 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +41 -2
- data/lib/access_control/authentication.rb +1 -1
- data/lib/access_control/base.rb +18 -11
- data/lib/controller/ext.rb +5 -3
- data/lib/controller/pdf_builder.rb +22 -6
- data/lib/controller/responds_to_parent.rb +1 -1
- data/lib/data_base/attachment_table.rb +0 -1
- data/lib/lipsiadmin.rb +7 -0
- data/lib/mailer/pdf_builder.rb +23 -9
- data/lib/version.rb +3 -3
- data/lib/view/helpers/backend_helper.rb +137 -97
- data/lib/view/helpers/ext/button.rb +62 -0
- data/lib/view/helpers/ext/column_model.rb +29 -23
- data/lib/view/helpers/ext/component.rb +52 -40
- data/lib/view/helpers/ext/configuration.rb +3 -2
- data/lib/view/helpers/ext/grid.rb +38 -40
- data/lib/view/helpers/ext/store.rb +12 -12
- data/lib/view/helpers/ext/templates/grid_functions.js.erb +14 -9
- data/lib/view/helpers/ext/tool_bar.rb +9 -10
- data/lib/view/helpers/ext_helper.rb +3 -2
- data/lib/view/helpers/pdf_helper.rb +45 -0
- data/lipsiadmin_generators/attachment/REMEMBER +0 -4
- data/lipsiadmin_generators/attachment/templates/migration.rb +1 -1
- data/lipsiadmin_generators/backend/templates/config/config.yml +2 -3
- data/lipsiadmin_generators/backend/templates/config/locales/backend/en.yml +2 -0
- data/lipsiadmin_generators/backend/templates/config/locales/backend/it.yml +2 -0
- data/lipsiadmin_generators/backend/templates/config/locales/models/{en.yml → account/en.yml} +0 -0
- data/lipsiadmin_generators/backend/templates/config/locales/models/{it.yml → account/it.yml} +0 -0
- data/lipsiadmin_generators/backend/templates/controllers/javascripts_controller.rb +1 -1
- data/lipsiadmin_generators/backend/templates/images/backend/association_break.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/backend/association_ok.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/backend/categories.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/charts.swf +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/sizer/se-handle.gif → default/button/arrow.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/group-cs.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/grid-blue-split.gif → default/button/group-lr.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/arrow-right-white.gif → default/button/group-tb.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-b-noline.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-b.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-bo.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/grid3-hrow.gif → default/button/s-arrow-noline.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow-o.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/s-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/form/checkbox.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/form/radio.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/form/trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/group-collapse.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/group-expand.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/refresh.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/sort-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tool-sprites.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/panel/tools-sprites-trans.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/qtip/tip-anchor-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/shadow-c.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-v-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/slider/slider-v-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/grid/arrow-left-white.gif → default/toolbar/more.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/toolbar/tb-xl-btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/{slate/panel/left-right.gif → default/toolbar/tb-xl-sep.gif} +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-right.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/left-right.psd +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/right-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/top-bottom.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/window/top-bottom.psd +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/expressinstall.swf +0 -0
- data/lipsiadmin_generators/backend/templates/javascripts/ext.js +97 -76
- data/lipsiadmin_generators/backend/templates/javascripts/prototype.js +14 -12
- data/lipsiadmin_generators/backend/templates/models/notifier.rb +1 -1
- data/lipsiadmin_generators/backend/templates/stylesheets/backend.css +11 -2
- data/lipsiadmin_generators/backend/templates/stylesheets/ext.css +1070 -546
- data/lipsiadmin_generators/backend/templates/stylesheets/login.css +1 -0
- data/lipsiadmin_generators/backend/templates/views/backend/accounts/index.rjs +1 -0
- data/lipsiadmin_generators/backend/templates/views/backend/base/index.html.haml +7 -4
- data/lipsiadmin_generators/backend/templates/views/javascripts/backend.js.erb +203 -143
- data/lipsiadmin_generators/pdf/pdf_generator.rb +1 -4
- data/lipsiadmin_generators/pdf/templates/view.html.haml +11 -6
- data/lipsiadmin_generators/state_session/state_session_generator.rb +2 -0
- data/resources/javascripts/ux.js +16 -17
- data/resources/javascripts/ux.min.js +2 -0
- data/resources/pd4ml/ruby/Pd4Ruby.class +0 -0
- data/resources/pd4ml/ruby/Pd4Ruby.java +277 -31
- data/tasks/lipsiadmin_tasks.rake +18 -1
- metadata +32 -124
- data/lipsiadmin_generators/backend/templates/images/ext/default/box/tb-slate.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/button/btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/default/grid/Thumbs.db +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/button/btn-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/button/btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/editor/tb-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/checkbox.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/clear-trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/date-trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/radio.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/search-trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/trigger-tpl.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/form/trigger.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/gradient-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/col-move-bottom.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/col-move-top.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/footer-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-blue-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-hrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-split.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid-vista-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hd-btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-hrow-over.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-special-col-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/grid3-special-col-sel-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/group-expand-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/mso-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-first-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-first.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-last-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-last.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-next-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-next.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-prev-disabled.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/page-prev.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/refresh.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/row-over.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/row-sel.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/sort_asc.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/grid/sort_desc.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/checked.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/group-checked.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/item-over - Copy.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/item-over.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/menu-parent.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/menu.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/menu/unchecked.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/corners-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/light-hd.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tool-sprite-tpl.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tool-sprites.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/tools-sprites-trans.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/top-bottom.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/top-bottom.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-corners-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-left-right.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/panel/white-top-bottom.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/progress/progress-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/close.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/qtip/tip-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/s.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/glass-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/hd-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/left-btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/shared/right-btn.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/e-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/e-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/ne-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/ne-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/nw-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/nw-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/s-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/s-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/se-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/square.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/sw-handle-dark.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/sizer/sw-handle.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-v-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/slider/slider-v-thumb.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroll-left.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroll-right.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/scroller-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-inactive-left-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-inactive-right-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-left-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-btm-right-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-close.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-bg.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tab-strip-btm-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tabs/tabs-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/bg-menu.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-arrow-light.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-arrow.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/btn-over-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/gray-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/tb-bg.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/toolbar/tb-btn-sprite.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/tree/arrows.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-error.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-info.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-question.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/icon-warning.gif +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/left-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/left-right.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/right-corners.png +0 -0
- data/lipsiadmin_generators/backend/templates/images/ext/slate/window/top-bottom.png +0 -0
- data/lipsiadmin_generators/backend/templates/stylesheets/backend-slate.css +0 -105
- data/lipsiadmin_generators/backend/templates/stylesheets/ext-slate.css +0 -241
data/CHANGELOG
CHANGED
@@ -1,5 +1,44 @@
|
|
1
|
-
2009-05
|
2
|
-
*
|
1
|
+
2009-06-05
|
2
|
+
* Dump to 5.0 Version
|
3
|
+
* Support to ExtJs 3.0
|
4
|
+
* Now we can browse with like "static" pages with back & next buttons of browsers [Ragunalth]
|
5
|
+
* Now we can call directly a page, usefull for do a manual refresh of a page but also for condivide links.
|
6
|
+
* Added a new method "un" for remove listners of extjs components
|
7
|
+
* Removed "l" method because we just have to_l for have literal json (ex: "function add(){...}".to_l)
|
8
|
+
* Removed unusued literals
|
9
|
+
* Refactored add method, now is possible to add components
|
10
|
+
* Renamed in ColumnModel add => add_column for conflict reason with add component
|
11
|
+
* Refactored Configuration (used for extjs)
|
12
|
+
* Fixed toolbar for add_buttons like "->" (ex: tbar.add_button :text => "->")
|
13
|
+
* Fixed a extra comma in attachment generator
|
14
|
+
* Fixed account grid generator
|
15
|
+
* Fixed attachment_table, now correctly include utility_scopes
|
16
|
+
* Fixed a little typo in ext controller component
|
17
|
+
* Maked ext columns compatible with extjs 3.0 and 2.0
|
18
|
+
* Added the possibility to add buttons with their menu
|
19
|
+
* Fixed Pdf generator now dude to limtis of previous version we don't put html to stdin but we made a tmp file
|
20
|
+
* Added Erb Templates in Pdf Generator
|
21
|
+
* Added mswin compatibility with Pdf Generator
|
22
|
+
* Fixed Ext DateTimeFiled with allowblank
|
23
|
+
* Removed the default allowBlank: true from Ext.form.DateTimeField
|
24
|
+
* Updated pdf mail builder according to new changes
|
25
|
+
* Removed from Controller Pdf Builder the layout for compatiblity with pdf mailer
|
26
|
+
* Changed simple_error_messages_for, now is localizable like default rails version
|
27
|
+
* Fixed path in in menu generation expecially when we use params
|
28
|
+
* Fixed a little issue when we regenerate locales for our models
|
29
|
+
* Fixed menu with empty urls and submenus
|
30
|
+
* Added a new option for column_model for render datetime to a date (:renderer => :time_to_date)
|
31
|
+
* Added a new option for column_model for render percentage (:renderer => :percentage)
|
32
|
+
* Fixed ext_date_select and ext_datetime_select to correctly render empty date(time) without the option :emptyToNow => true
|
33
|
+
* Fixed correctly the time in ext_datetime_select when :emptyToNow => true
|
34
|
+
* Change the box, now for render it (for uniformity reason) we need to use -box "My Box" do; some; end; instead of =box "My Box" ...
|
35
|
+
* Added AccountAccess caching, you can expire that using Lipsiadmin::AccountAccess::Base.cache[account.id] = nil
|
36
|
+
* Added Rake Tasks for start|stop|restart loops/background_workers
|
37
|
+
* Added handler :after => "myfn()" to open_form
|
38
|
+
* Added a new option to attachment_tag and attachments_tag for only upload files without manage the old ones
|
39
|
+
* Added the possiblity to personalize ttbar using only necessary buttons like ttbar [:edit, :delete] or [:add, :delete]
|
40
|
+
* Fixed a little bug in state_session generator
|
41
|
+
* Added few new images in backend
|
3
42
|
|
4
43
|
2009-05-28
|
5
44
|
* Refactored account_access now current_account (account logged) is aviable in our roles
|
data/lib/access_control/base.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Lipsiadmin
|
2
2
|
module AccessControl
|
3
|
+
|
3
4
|
module Helper#:nodoc:
|
4
5
|
def recognize_path(path)#:nodoc:
|
5
6
|
case path
|
@@ -42,6 +43,8 @@ module Lipsiadmin
|
|
42
43
|
# - Access to all actions EXCEPT <tt>details</tt> of controller "/backend/accounts"
|
43
44
|
#
|
44
45
|
class Base
|
46
|
+
@@cache = {}
|
47
|
+
cattr_accessor :cache
|
45
48
|
|
46
49
|
class << self
|
47
50
|
|
@@ -58,13 +61,14 @@ module Lipsiadmin
|
|
58
61
|
def roles
|
59
62
|
@roles.nil? ? [] : @roles.collect(&:to_s)
|
60
63
|
end
|
61
|
-
|
64
|
+
|
65
|
+
# Returns maps (allowed && denied actions) for the given account
|
62
66
|
def maps_for(account)
|
63
|
-
@mappers.collect { |m| m.call(account) }.
|
64
|
-
|
67
|
+
@@cache[account.id] ||= @mappers.collect { |m| m.call(account) }.
|
68
|
+
reject { |m| !m.allowed? }
|
69
|
+
@@cache[account.id]
|
65
70
|
end
|
66
71
|
end
|
67
|
-
|
68
72
|
end
|
69
73
|
|
70
74
|
class Mapper
|
@@ -178,20 +182,23 @@ module Lipsiadmin
|
|
178
182
|
class Menu
|
179
183
|
include Helper
|
180
184
|
include ActionController::UrlWriter
|
181
|
-
attr_reader :name, :options, :
|
185
|
+
attr_reader :name, :options, :items
|
182
186
|
|
183
187
|
def initialize(name, path=nil, options={}, &block)#:nodoc:
|
184
188
|
@name = name
|
189
|
+
@url = path
|
185
190
|
@options = options
|
186
191
|
@allowed = []
|
187
192
|
@items = []
|
188
|
-
if
|
189
|
-
@url = recognize_path(path)
|
190
|
-
@allowed << { :controller => @url[:controller] } if path
|
191
|
-
end
|
193
|
+
@allowed << { :controller => recognize_path(path)[:controller] } if @url
|
192
194
|
yield self if block_given?
|
193
195
|
end
|
194
196
|
|
197
|
+
# Return the url of this menu
|
198
|
+
def url
|
199
|
+
@url.is_a?(Hash) ? url_for(@url.merge(:only_path => true)) : @url
|
200
|
+
end
|
201
|
+
|
195
202
|
# Add a new submenu to the menu
|
196
203
|
def add(name, path=nil, options={}, &block)
|
197
204
|
@items << Menu.new(name, path, options, &block)
|
@@ -215,12 +222,12 @@ module Lipsiadmin
|
|
215
222
|
|
216
223
|
# Return ExtJs Config for this menu
|
217
224
|
def config
|
218
|
-
if @url.blank?
|
225
|
+
if @url.blank? && @items.empty?
|
219
226
|
options = human_name
|
220
227
|
else
|
221
228
|
options = @options.merge(:text => human_name)
|
222
229
|
options.merge!(:menu => @items.collect(&:config)) if @items.size > 0
|
223
|
-
options.merge!(:handler => "function(){ Backend.app.load('#{
|
230
|
+
options.merge!(:handler => "function(){ Backend.app.load('#{url}') }".to_l) if !@url.blank?
|
224
231
|
end
|
225
232
|
options
|
226
233
|
end
|
data/lib/controller/ext.rb
CHANGED
@@ -105,7 +105,9 @@ module Lipsiadmin
|
|
105
105
|
options[:mapping] ||= options[:dataIndex].to_s.downcase.gsub(/[^a-z0-9]+/, '_').
|
106
106
|
gsub(/-+$/, '_').
|
107
107
|
gsub(/^-+$/, '_')
|
108
|
-
|
108
|
+
# Now is necessary for our columns an ID
|
109
|
+
options[:id] = options[:mapping]
|
110
|
+
|
109
111
|
@data << options
|
110
112
|
end
|
111
113
|
|
@@ -125,8 +127,8 @@ module Lipsiadmin
|
|
125
127
|
def store_fields
|
126
128
|
@data.inject([]) do |fields, data|
|
127
129
|
hash = { :name => data[:dataIndex], :mapping => data[:mapping] }
|
128
|
-
hash.merge!(:type => data[:renderer]) if
|
129
|
-
(data[:renderer] == :date || data[:renderer] == :datetime)
|
130
|
+
hash.merge!(:type => data[:renderer]) if data[:renderer] &&
|
131
|
+
(data[:renderer] == :date || data[:renderer] == :datetime || data[:renderer] == :time_to_date)
|
130
132
|
fields << hash
|
131
133
|
fields
|
132
134
|
end
|
@@ -47,10 +47,14 @@ module Lipsiadmin
|
|
47
47
|
# path to the pd4ml jarfile
|
48
48
|
jars_path = Lipsiadmin::Utils::PdfBuilder::JARS_PATH
|
49
49
|
|
50
|
-
options[:landescape]
|
50
|
+
options[:landescape] = options[:landescape] ? "LANDESCAPE" : "PORTRAIT"
|
51
51
|
options[:send_data] ||= !filename.blank?
|
52
|
+
|
53
|
+
# try to find erb extension
|
54
|
+
ext = File.exist?("#{RAILS_ROOT}/app/views/pdf/#{template}.html.erb") ? "erb" : "haml"
|
55
|
+
|
52
56
|
# encode the template
|
53
|
-
input = encode_entities(render(:template => "/pdf/#{template}.html
|
57
|
+
input = encode_entities(render(:template => "/pdf/#{template}.html.#{ext}"))
|
54
58
|
|
55
59
|
# search for stylesheet links and make their paths absolute.
|
56
60
|
input.gsub!('<link href="/javascripts', '<link href="' + RAILS_ROOT + '/public/javascripts')
|
@@ -60,12 +64,22 @@ module Lipsiadmin
|
|
60
64
|
input.gsub!('src="/', 'src="' + RAILS_ROOT + '/public/')
|
61
65
|
input.gsub!('url(','url('+RAILS_ROOT+'/public')
|
62
66
|
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
# write our temp file
|
68
|
+
t = Tempfile.new("pd4ml.html", "#{Rails.root}/tmp")
|
69
|
+
t.binmode
|
70
|
+
t.write(input)
|
71
|
+
t.flush
|
72
|
+
|
73
|
+
# build the command
|
74
|
+
class_path = "#{jars_path}/pd4ml.jar:.:#{jars_path}"
|
75
|
+
class_path = "\"#{jars_path}/pd4ml.jar\";\"#{jars_path}\"" if RUBY_PLATFORM =~ /mswin/
|
76
|
+
cmd = "cd #{Lipsiadmin::Utils::PdfBuilder::PD4RUBY_PATH} && java -Xmx512m -Djava.awt.headless=true -cp #{class_path} Pd4Ruby --file \"#{t.path}\" --width 950 --orientation #{options[:landescape]} 2>&1"
|
77
|
+
|
78
|
+
# grep the output
|
79
|
+
output = IO.popen(cmd) { |s| s.read }
|
66
80
|
|
67
81
|
# raise error if process returned false (ie: a java error)
|
68
|
-
raise PdfError, "An unknonwn error occurred while generating pdf
|
82
|
+
raise PdfError, "An unknonwn error occurred while generating pdf" if $?.exitstatus == 127
|
69
83
|
|
70
84
|
# return raw pdf binary-stream
|
71
85
|
if options[:send_data]
|
@@ -76,6 +90,8 @@ module Lipsiadmin
|
|
76
90
|
erase_results
|
77
91
|
output
|
78
92
|
end
|
93
|
+
# ensure
|
94
|
+
# t.close
|
79
95
|
end
|
80
96
|
|
81
97
|
# Errors For PDF
|
@@ -12,7 +12,6 @@ module Lipsiadmin
|
|
12
12
|
# <tt>has_many_attachments</tt> can override/add styles/validations etc...
|
13
13
|
#
|
14
14
|
class AttachmentTable < ActiveRecord::Base
|
15
|
-
|
16
15
|
def self.inherited(subclass)#:nodoc:
|
17
16
|
super
|
18
17
|
subclass.write_inheritable_attribute(:attachment_definitions, {}) if subclass.attachment_definitions.nil?
|
data/lib/lipsiadmin.rb
CHANGED
@@ -10,6 +10,7 @@ require 'view/helpers/backend_helper'
|
|
10
10
|
require 'view/helpers/frontend_helper'
|
11
11
|
require 'view/helpers/view_helper'
|
12
12
|
require 'view/helpers/ext_helper'
|
13
|
+
require 'view/helpers/pdf_helper'
|
13
14
|
require 'controller/ext'
|
14
15
|
require 'controller/pdf_builder'
|
15
16
|
require 'controller/responds_to_parent'
|
@@ -41,6 +42,7 @@ ActionView::Base.class_eval do
|
|
41
42
|
include Lipsiadmin::View::Helpers::FormTagHelper
|
42
43
|
include Lipsiadmin::View::Helpers::DateHelper
|
43
44
|
include Lipsiadmin::View::Helpers::CountrySelectHelper
|
45
|
+
include Lipsiadmin::View::Helpers::PdfHelper
|
44
46
|
end
|
45
47
|
|
46
48
|
ActionView::Helpers::FormBuilder.send(:include, Lipsiadmin::View::Helpers::FormBuilder)
|
@@ -57,6 +59,11 @@ ActionController::Base.class_eval do
|
|
57
59
|
include Lipsiadmin::AccessControl::Authentication
|
58
60
|
end
|
59
61
|
|
62
|
+
ActionMailer::Base.class_eval do
|
63
|
+
include Lipsiadmin::Mailer::PdfBuilder
|
64
|
+
include Lipsiadmin::View::Helpers::PdfHelper
|
65
|
+
end
|
66
|
+
|
60
67
|
# For Attachments
|
61
68
|
File.send(:include, Lipsiadmin::Attachment::Upfile)
|
62
69
|
|
data/lib/mailer/pdf_builder.rb
CHANGED
@@ -52,11 +52,13 @@ module Lipsiadmin
|
|
52
52
|
# path to the pd4ml jarfile
|
53
53
|
jars_path = Lipsiadmin::Utils::PdfBuilder::JARS_PATH
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
body[:landescape] = body[:landescape] ? "LANDESCAPE" : "PORTRAIT"
|
56
|
+
|
57
|
+
# try to find erb extension
|
58
|
+
ext = File.exist?("#{RAILS_ROOT}/app/views/pdf/#{template}.html.erb") ? "erb" : "haml"
|
59
|
+
|
58
60
|
# encode the template
|
59
|
-
input = encode_entities(render_message("/pdf/#{template}.html
|
61
|
+
input = encode_entities(render_message("/pdf/#{template}.html.#{ext}", body))
|
60
62
|
|
61
63
|
# search for stylesheet links and make their paths absolute.
|
62
64
|
input.gsub!('<link href="/javascripts', '<link href="' + RAILS_ROOT + '/public/javascripts')
|
@@ -66,15 +68,27 @@ module Lipsiadmin
|
|
66
68
|
input.gsub!('src="/', 'src="' + RAILS_ROOT + '/public/')
|
67
69
|
input.gsub!('url(','url('+RAILS_ROOT+'/public')
|
68
70
|
|
69
|
-
|
71
|
+
# write our temp file
|
72
|
+
t = Tempfile.new("pd4ml.html", "#{Rails.root}/tmp")
|
73
|
+
t.binmode
|
74
|
+
t.write(input)
|
75
|
+
t.flush
|
76
|
+
|
77
|
+
# build the command
|
78
|
+
class_path = "#{jars_path}/pd4ml.jar:.:#{jars_path}"
|
79
|
+
class_path = "\"#{jars_path}/pd4ml.jar\";\"#{jars_path}\"" if RUBY_PLATFORM =~ /mswin/
|
80
|
+
cmd = "cd #{Lipsiadmin::Utils::PdfBuilder::PD4RUBY_PATH} && java -Xmx512m -Djava.awt.headless=true -cp #{class_path} Pd4Ruby --file \"#{t.path}\" --width 950 --orientation #{body[:landescape]} 2>&1"
|
70
81
|
|
71
|
-
|
82
|
+
# grep the output
|
83
|
+
output = IO.popen(cmd) { |s| s.read }
|
72
84
|
|
73
85
|
# raise error if process returned false (ie: a java error)
|
74
|
-
raise PdfError, "An unknonwn error occurred while generating pdf
|
86
|
+
raise PdfError, "An unknonwn error occurred while generating pdf" if $?.exitstatus == 127
|
75
87
|
|
76
|
-
#return raw pdf binary-stream
|
77
|
-
output
|
88
|
+
# return raw pdf binary-stream
|
89
|
+
output
|
90
|
+
ensure
|
91
|
+
t.close
|
78
92
|
end
|
79
93
|
end
|
80
94
|
|
data/lib/version.rb
CHANGED
@@ -4,17 +4,49 @@ module Lipsiadmin
|
|
4
4
|
module BackendHelper
|
5
5
|
# This method work like builtin Rails error_message_for but use an Ext.Message.show({..})
|
6
6
|
def simple_error_messages_for(*params)
|
7
|
-
options = params.
|
8
|
-
|
9
|
-
|
7
|
+
options = params.extract_options!.symbolize_keys
|
8
|
+
|
9
|
+
if object = options.delete(:object)
|
10
|
+
objects = [object].flatten
|
11
|
+
else
|
12
|
+
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
|
13
|
+
end
|
14
|
+
|
15
|
+
count = objects.inject(0) {|sum, object| sum + object.errors.count }
|
10
16
|
unless count.zero?
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
html = {}
|
18
|
+
[:id, :class].each do |key|
|
19
|
+
if options.include?(key)
|
20
|
+
value = options[key]
|
21
|
+
html[key] = value unless value.blank?
|
22
|
+
else
|
23
|
+
html[key] = 'errorExplanation'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
options[:object_name] ||= params.first
|
27
|
+
|
28
|
+
I18n.with_options :locale => options[:locale], :scope => [:activerecord, :errors, :template] do |locale|
|
29
|
+
header_message = if options.include?(:header_message)
|
30
|
+
options[:header_message]
|
31
|
+
else
|
32
|
+
object_name = options[:object_name].to_s.gsub('_', ' ')
|
33
|
+
object_name = I18n.t(object_name, :default => object_name, :scope => [:activerecord, :models], :count => 1)
|
34
|
+
locale.t :header, :count => count, :model => object_name
|
35
|
+
end
|
36
|
+
message = options.include?(:message) ? options[:message] : locale.t(:body)
|
37
|
+
error_messages = objects.sum {|object| object.errors.full_messages.map {|msg| content_tag(:li, ERB::Util.html_escape(msg)) } }.join
|
38
|
+
|
39
|
+
contents = ''
|
40
|
+
contents << content_tag(:p, message) unless message.blank?
|
41
|
+
contents << content_tag(:ul, error_messages, :class => :list)
|
42
|
+
|
43
|
+
content_tag(:script, "Ext.Msg.show({
|
44
|
+
title: '#{header_message}',
|
45
|
+
msg: '<ul>#{contents}</ul>',
|
46
|
+
buttons: Ext.Msg.OK,
|
47
|
+
minWidth: 400
|
48
|
+
});", :type => Mime::JS)
|
49
|
+
end
|
18
50
|
else
|
19
51
|
''
|
20
52
|
end
|
@@ -162,7 +194,8 @@ module Lipsiadmin
|
|
162
194
|
#
|
163
195
|
# Options can be one of the following:
|
164
196
|
#
|
165
|
-
# <tt>:image</tt>::
|
197
|
+
# <tt>:image</tt>:: Indicate if the attachments are ONLY images.
|
198
|
+
# <tt>:only_upload</tt>:: Indicate that is not necessary manage the old attachments.
|
166
199
|
#
|
167
200
|
# Examples:
|
168
201
|
#
|
@@ -180,40 +213,43 @@ module Lipsiadmin
|
|
180
213
|
variable = instance_variable_get("@#{object_name}")
|
181
214
|
html = []
|
182
215
|
html << '<!-- Generated from Lipsiadmin -->'
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
216
|
+
|
217
|
+
unless options[:only_upload]
|
218
|
+
html << '<ul id="' + "#{method}-order" + '" class="label">'
|
219
|
+
|
220
|
+
if attachment = variable.send(method)
|
221
|
+
# Create first the remove link
|
222
|
+
remove_link = link_to_remote(tl(:remove), :url => "/backend/attachments/#{attachment.id}",
|
223
|
+
:method => :delete,
|
224
|
+
:success => "$('#{method}_#{attachment.id}').remove();")
|
225
|
+
|
226
|
+
if options[:image]
|
227
|
+
fstyle = "float:left;margin:5px;margin-left:0px;"
|
228
|
+
fclass = "box-image"
|
229
|
+
ftag = '<div>' + image_tag(attachment.url(:thumb)) + '</div>'
|
230
|
+
ftag += '<div style="text-align:center;padding:5px;cursor:pointer">'
|
231
|
+
ftag += ' ' + remove_link
|
232
|
+
ftag += '</div>'
|
233
|
+
else
|
234
|
+
fstyle = "padding:5px;border-bottom:1px solid #DDE7F5;"
|
235
|
+
fclass = "box-file"
|
236
|
+
ftag = '<div style="float:left;cursor:pointer">'
|
237
|
+
ftag += ' ' + link_to(attachment.attached_file_name, attachment.url) + ' ' + number_to_human_size(attachment.attached_file_size)
|
238
|
+
ftag += '</div>'
|
239
|
+
ftag += '<div style="float:right;cursor:pointer">'
|
240
|
+
ftag += ' ' + remove_link
|
241
|
+
ftag += '</div>'
|
242
|
+
ftag += '<br style="clear:both" />'
|
243
|
+
end
|
244
|
+
|
245
|
+
html << '<li id="' + "#{method}_#{attachment.id}" + '" class="' + fclass + '" style="' + fstyle + '">'
|
246
|
+
html << ' ' + ftag
|
247
|
+
html << '</li>'
|
248
|
+
end # End of Loop
|
249
|
+
|
250
|
+
html << '</ul>'
|
251
|
+
html << '<br style="clear:both" />'
|
252
|
+
end
|
217
253
|
|
218
254
|
flbl = options[:image] ? :upload_image : :upload_file
|
219
255
|
html << '<div class="label-title">' + tl(flbl) + '</div>'
|
@@ -231,8 +267,9 @@ module Lipsiadmin
|
|
231
267
|
#
|
232
268
|
# Options can be one of the following:
|
233
269
|
#
|
234
|
-
# <tt>:image</tt>::
|
235
|
-
# <tt>:
|
270
|
+
# <tt>:image</tt>:: Indicate if the attachments are ONLY images.
|
271
|
+
# <tt>:only_upload</tt>:: Indicate that is not necessary manage the old attachments.
|
272
|
+
# <tt>:order</tt>:: Indicate if user can order files.
|
236
273
|
#
|
237
274
|
# Examples:
|
238
275
|
#
|
@@ -251,50 +288,53 @@ module Lipsiadmin
|
|
251
288
|
variable = instance_variable_get("@#{object_name}")
|
252
289
|
html = []
|
253
290
|
html << '<!-- Generated from Lipsiadmin -->'
|
254
|
-
|
291
|
+
unless options[:only_upload]
|
292
|
+
html << '<ul id="' + "#{method}-order" + '" class="label">'
|
293
|
+
|
294
|
+
for attachment in variable.send(method).all(:order => :position)
|
295
|
+
# Create first the remove link
|
296
|
+
remove_link = link_to_remote(tl(:remove), :url => "/backend/attachments/#{attachment.id}",
|
297
|
+
:method => :delete,
|
298
|
+
:success => "$('#{method}_#{attachment.id}').remove();")
|
299
|
+
|
300
|
+
if options[:image]
|
301
|
+
fstyle = "float:left;margin:5px;margin-left:0px;"
|
302
|
+
fstyle += "cursor:move;" if options[:order]
|
303
|
+
fclass = "box-image"
|
304
|
+
ftag = '<div>' + image_tag(attachment.url(:thumb)) + '</div>'
|
305
|
+
ftag += '<div style="text-align:center;padding:5px;cursor:pointer">'
|
306
|
+
ftag += ' ' + remove_link
|
307
|
+
ftag += '</div>'
|
308
|
+
else
|
309
|
+
fstyle = "padding:5px;border-bottom:1px solid #DDE7F5;"
|
310
|
+
fstyle += "cursor:move;" if options[:order]
|
311
|
+
fclass = "box-file"
|
312
|
+
ftag = '<div style="float:left;cursor:pointer">'
|
313
|
+
ftag += ' ' + link_to(attachment.attached_file_name, attachment.url) + ' ' + number_to_human_size(attachment.attached_file_size)
|
314
|
+
ftag += '</div>'
|
315
|
+
ftag += '<div style="float:right;cursor:pointer">'
|
316
|
+
ftag += ' ' + remove_link
|
317
|
+
ftag += '</div>'
|
318
|
+
ftag += '<br style="clear:both" />'
|
319
|
+
end
|
320
|
+
|
321
|
+
html << '<li id="' + "#{method}_#{attachment.id}" + '" class="' + fclass + '" style="' + fstyle + '">'
|
322
|
+
html << ' ' + ftag
|
323
|
+
html << '</li>'
|
324
|
+
end # End of Loop
|
325
|
+
|
326
|
+
html << '</ul>'
|
327
|
+
html << '<br style="clear:both" />'
|
328
|
+
|
255
329
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
if options[:image]
|
263
|
-
fstyle = "float:left;margin:5px;margin-left:0px;"
|
264
|
-
fstyle += "cursor:move;" if options[:order]
|
265
|
-
fclass = "box-image"
|
266
|
-
ftag = '<div>' + image_tag(attachment.url(:thumb)) + '</div>'
|
267
|
-
ftag += '<div style="text-align:center;padding:5px;cursor:pointer">'
|
268
|
-
ftag += ' ' + remove_link
|
269
|
-
ftag += '</div>'
|
270
|
-
else
|
271
|
-
fstyle = "padding:5px;border-bottom:1px solid #DDE7F5;"
|
272
|
-
fstyle += "cursor:move;" if options[:order]
|
273
|
-
fclass = "box-file"
|
274
|
-
ftag = '<div style="float:left;cursor:pointer">'
|
275
|
-
ftag += ' ' + link_to(attachment.attached_file_name, attachment.url) + ' ' + number_to_human_size(attachment.attached_file_size)
|
276
|
-
ftag += '</div>'
|
277
|
-
ftag += '<div style="float:right;cursor:pointer">'
|
278
|
-
ftag += ' ' + remove_link
|
279
|
-
ftag += '</div>'
|
280
|
-
ftag += '<br style="clear:both" />'
|
330
|
+
if options[:order]
|
331
|
+
constraint = options[:image] ? "horizontal" : "vertical"
|
332
|
+
html << '<div id="' + "#{method}-message" + '" style="padding:5px"> </div>'
|
333
|
+
html << sortable_element("#{method}-order", :url => "/backend/attachments/order", :update => "#{method}-message", :constraint => constraint,
|
334
|
+
:complete => visual_effect(:highlight, "#{method}-message", :duration => 0.5))
|
281
335
|
end
|
282
|
-
|
283
|
-
html << '<li id="' + "#{method}_#{attachment.id}" + '" class="' + fclass + '" style="' + fstyle + '">'
|
284
|
-
html << ' ' + ftag
|
285
|
-
html << '</li>'
|
286
|
-
end # End of Loop
|
287
|
-
|
288
|
-
html << '</ul>'
|
289
|
-
html << '<br style="clear:both" />'
|
290
|
-
|
291
|
-
if options[:order]
|
292
|
-
constraint = options[:image] ? "horizontal" : "vertical"
|
293
|
-
html << '<div id="' + "#{method}-message" + '" style="padding:5px"> </div>'
|
294
|
-
html << sortable_element("#{method}-order", :url => "/backend/attachments/order", :update => "#{method}-message", :constraint => constraint,
|
295
|
-
:complete => visual_effect(:highlight, "#{method}-message", :duration => 0.5))
|
296
336
|
end
|
297
|
-
|
337
|
+
|
298
338
|
flbl = options[:image] ? :upload_images : :upload_files
|
299
339
|
html << '<div class="label-title">'+ tl(flbl) +'</div>'
|
300
340
|
html << '<table>'
|
@@ -411,7 +451,8 @@ module Lipsiadmin
|
|
411
451
|
# The third argument are callbacks that may be specified:
|
412
452
|
#
|
413
453
|
# <tt>:before</tt>:: Called before request is initiated.
|
414
|
-
# <tt>:
|
454
|
+
# <tt>:after</tt>:: Called after request is initiated.
|
455
|
+
# <tt>:on_save</tt>:: Called after user press +save+ button.
|
415
456
|
# This call are performed in an handler where
|
416
457
|
# you have access to one variables:
|
417
458
|
# <tt>:win</tt>:: Backend.window
|
@@ -427,7 +468,7 @@ module Lipsiadmin
|
|
427
468
|
# # }
|
428
469
|
# # }).show();
|
429
470
|
# # return false;" href="#">Edit Post</a>
|
430
|
-
# open_form "Edit Post", "/backend/posts/'+$('comment_post_id').value+'/edit", :update => "someFn();"
|
471
|
+
# open_form "Edit Post", "/backend/posts/'+$('comment_post_id').value+'/edit", :update => "someFn(win);"
|
431
472
|
#
|
432
473
|
def open_form(text, url, options={})
|
433
474
|
options[:before] = options[:before] + ";" if options[:before]
|
@@ -437,11 +478,10 @@ module Lipsiadmin
|
|
437
478
|
url: '#{url}',
|
438
479
|
form: true,
|
439
480
|
listeners: {
|
440
|
-
saved: function(win){
|
441
|
-
|
442
|
-
}
|
481
|
+
saved: function(win){ #{options[:on_save]} },
|
482
|
+
close: function(panel){ #{options[:after]} }
|
443
483
|
}
|
444
|
-
}).show()
|
484
|
+
}).show();
|
445
485
|
JAVASCRIPT
|
446
486
|
link_to_function(text, javascript.gsub(/\n/, " "))
|
447
487
|
end
|
@@ -464,7 +504,7 @@ module Lipsiadmin
|
|
464
504
|
#
|
465
505
|
# Examples:
|
466
506
|
#
|
467
|
-
#
|
507
|
+
# -box "My Title", "My Subtitle", :submit => true, :collapsible => true, :style => "padding:none", :start => :close do
|
468
508
|
# my content
|
469
509
|
#
|
470
510
|
# Defaults:
|
@@ -474,9 +514,9 @@ module Lipsiadmin
|
|
474
514
|
# * :start => :close
|
475
515
|
#
|
476
516
|
def box(title=nil, subtitle=nil, options={}, &block)
|
477
|
-
options[:style] ||= "width:
|
517
|
+
options[:style] ||= "width:100%;"
|
478
518
|
options[:start] ||= :open
|
479
|
-
|
519
|
+
concat <<-HTML
|
480
520
|
<div class="x-box" style="#{options[:style]}">
|
481
521
|
<div class="x-box-tl">
|
482
522
|
<div class="x-box-tr">
|