compass_ae_sencha 1.0.1 → 1.0.2
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.
@@ -0,0 +1,102 @@
|
|
1
|
+
ActionView::Base.class_eval do
|
2
|
+
|
3
|
+
def static_javascript_include_tag(*srcs)
|
4
|
+
raw srcs.flatten.map { |src| "<script type=\"text/javascript\" src=\"/javascripts/#{src.include?('.js') ? src : "#{src}.js"}\"></script>" }.join("")
|
5
|
+
end
|
6
|
+
|
7
|
+
def static_stylesheet_link_tag(*srcs)
|
8
|
+
raw srcs.flatten.map { |src| "<link rel=\"stylesheet\" type=\"text/css\" href=\"/stylesheets/#{src.include?('.css') ? src : "#{src}.css"}\" />" }.join("")
|
9
|
+
end
|
10
|
+
|
11
|
+
def include_extjs(opt={})
|
12
|
+
resources = ''
|
13
|
+
|
14
|
+
if opt[:debug]
|
15
|
+
resources << static_javascript_include_tag("extjs/ext-all-debug.js")
|
16
|
+
else
|
17
|
+
resources << static_javascript_include_tag("extjs/ext-all.js")
|
18
|
+
end
|
19
|
+
|
20
|
+
resources << static_javascript_include_tag("extjs/helpQtip.js")
|
21
|
+
resources << static_javascript_include_tag("extjs/ext_ux_tab_close_menu.js")
|
22
|
+
resources << static_javascript_include_tag("extjs/Ext.ux.form.MultiSelect.js")
|
23
|
+
resources << static_javascript_include_tag("extjs/Ext.ux.CheckColumn.js")
|
24
|
+
|
25
|
+
if opt[:theme] === false
|
26
|
+
#do nothing not theme loaded.
|
27
|
+
elsif opt[:theme]
|
28
|
+
theme = opt[:theme].split(':')[0]
|
29
|
+
sub_theme = opt[:theme].split(':')[1]
|
30
|
+
resources << static_stylesheet_link_tag("#{theme}/resources/css/#{sub_theme}.css")
|
31
|
+
else
|
32
|
+
#this file will effectively be used as the default stylesheet if no theme is selected
|
33
|
+
resources << static_stylesheet_link_tag("clifton/resources/css/clifton.css")
|
34
|
+
end
|
35
|
+
|
36
|
+
resources << add_authenticity_token_to_extjs
|
37
|
+
|
38
|
+
# this requirement is new in ExtJS 4.1
|
39
|
+
resources << "<script type=\"text/javascript\">Ext.Loader.setConfig({ enabled: true, disableCaching: false });</script>"
|
40
|
+
|
41
|
+
raw resources
|
42
|
+
end
|
43
|
+
|
44
|
+
def include_sencha_touch(opt={})
|
45
|
+
resources = ''
|
46
|
+
|
47
|
+
if (opt[:debug])
|
48
|
+
resources << static_javascript_include_tag("sencha_touch/sencha-touch-all-debug.js")
|
49
|
+
else
|
50
|
+
resources << static_javascript_include_tag("sencha_touch/sencha-touch-all.js")
|
51
|
+
end
|
52
|
+
|
53
|
+
if opt[:theme] === false
|
54
|
+
#do nothing not theme loaded.
|
55
|
+
elsif opt[:theme]
|
56
|
+
resources << static_stylesheet_link_tag("sencha_touch/resources/css/#{opt[:theme]}")
|
57
|
+
else
|
58
|
+
resources << static_stylesheet_link_tag("sencha_touch/resources/css/sencha-touch.css")
|
59
|
+
end
|
60
|
+
|
61
|
+
raw resources
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_authenticity_token_to_extjs
|
65
|
+
raw "<script type='text/javascript'>Ext.ns('Compass.ErpApp'); Ext.Ajax.extraParams = { authenticity_token: '#{form_authenticity_token}' }; Compass.ErpApp.AuthentictyToken = '#{form_authenticity_token}';</script>"
|
66
|
+
end
|
67
|
+
|
68
|
+
def create_authenticity_token_sencha_touch_field
|
69
|
+
raw "<script type='text/javascript'>Compass.ErpApp.Mobile.AuthentictyTokenField = {xtype:'hiddenfield', name:'authenticity_token', value:'#{form_authenticity_token}'}; </script>"
|
70
|
+
end
|
71
|
+
|
72
|
+
# example usage:
|
73
|
+
# <%= dynamic_extjs_grid({
|
74
|
+
# :title => 'Accounts',
|
75
|
+
# :renderTo => 'grid_target',
|
76
|
+
# :setupUrl => build_widget_url(:accounts_grid_setup),
|
77
|
+
# :dataUrl => build_widget_url(:accounts_grid_data),
|
78
|
+
# :width => 500,
|
79
|
+
# :height => 200,
|
80
|
+
# :page => true,
|
81
|
+
# :pageSize => 5,
|
82
|
+
# :displayMsg => 'Displaying {0} - {1} of {2}',
|
83
|
+
# :emptyMsg => 'Empty',
|
84
|
+
# :storeId => "my_unique_store_id" #this is an optional field
|
85
|
+
# }) %>
|
86
|
+
def dynamic_extjs_grid(options={})
|
87
|
+
options[:title] = '' if options[:title].blank?
|
88
|
+
options[:closable] = false if options[:closable].blank?
|
89
|
+
options[:collapsible] = false if options[:collapsible].blank?
|
90
|
+
options[:height] = 300 if options[:height].blank?
|
91
|
+
|
92
|
+
raw "<script type='text/javascript'>new OnDemandLoadByAjax().load([
|
93
|
+
'/javascripts/erp_app/shared/dynamic_editable_grid.js',
|
94
|
+
'/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js'],
|
95
|
+
function(){
|
96
|
+
var task = Ext.create('Ext.util.DelayedTask', function () { Ext.create('Compass.ErpApp.Shared.DynamicEditableGridLoaderPanel', #{options.to_json} );});
|
97
|
+
task.delay(200);
|
98
|
+
});</script>"
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'compass_ae_sencha/extensions/railties/action_view/base'
|
data/lib/compass_ae_sencha.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compass_ae_sencha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This gem provides the Sencha library for CompassAE.
|
15
15
|
email:
|
@@ -5994,6 +5994,8 @@ files:
|
|
5994
5994
|
- public/stylesheets/sencha_touch/resources/themes/vendor/compass-recipes/tests/recipes/ui/webfont-icons/s.scss
|
5995
5995
|
- public/stylesheets/sencha_touch/resources/themes/vendor/compass-recipes/VERSION
|
5996
5996
|
- lib/compass_ae_sencha/engine.rb
|
5997
|
+
- lib/compass_ae_sencha/extensions/railties/action_view/base.rb
|
5998
|
+
- lib/compass_ae_sencha/extensions.rb
|
5997
5999
|
- lib/compass_ae_sencha/version.rb
|
5998
6000
|
- lib/compass_ae_sencha.rb
|
5999
6001
|
- LICENSE
|