semantic-ui-rails 0.1.0 → 0.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/semantic/install/install_generator.rb +3 -3
  3. data/lib/generators/semantic/install/templates/semantic-ui.css.less +47 -0
  4. data/lib/semantic/ui/rails/version.rb +1 -1
  5. data/semantic.thor +29 -25
  6. data/vendor/assets/javascripts/semantic-ui/modules/accordion.js +7 -0
  7. data/vendor/assets/javascripts/semantic-ui/modules/chatroom.js +1 -1
  8. data/vendor/assets/javascripts/semantic-ui/modules/checkbox.js +2 -5
  9. data/vendor/assets/javascripts/semantic-ui/modules/dimmer.js +73 -49
  10. data/vendor/assets/javascripts/semantic-ui/modules/dropdown.js +135 -136
  11. data/vendor/assets/javascripts/semantic-ui/modules/modal.js +196 -125
  12. data/vendor/assets/javascripts/semantic-ui/modules/popup.js +3 -6
  13. data/vendor/assets/javascripts/semantic-ui/modules/rating.js +80 -38
  14. data/vendor/assets/javascripts/semantic-ui/modules/sidebar.js +17 -20
  15. data/vendor/assets/javascripts/semantic-ui/modules/tab.js +32 -20
  16. data/vendor/assets/javascripts/semantic-ui/modules/transition.js +2 -0
  17. data/vendor/assets/stylesheets/semantic-ui/collections/form.less +15 -2
  18. data/vendor/assets/stylesheets/semantic-ui/collections/grid.less +20 -39
  19. data/vendor/assets/stylesheets/semantic-ui/collections/menu.less +12 -12
  20. data/vendor/assets/stylesheets/semantic-ui/elements/basic.icon.less +203 -198
  21. data/vendor/assets/stylesheets/semantic-ui/elements/button.less +17 -6
  22. data/vendor/assets/stylesheets/semantic-ui/elements/header.less +49 -31
  23. data/vendor/assets/stylesheets/semantic-ui/elements/icon.less +9 -13
  24. data/vendor/assets/stylesheets/semantic-ui/elements/image.less +13 -1
  25. data/vendor/assets/stylesheets/semantic-ui/elements/input.less +1 -1
  26. data/vendor/assets/stylesheets/semantic-ui/elements/loader.less +8 -8
  27. data/vendor/assets/stylesheets/semantic-ui/modules/checkbox.less +1 -1
  28. data/vendor/assets/stylesheets/semantic-ui/modules/dimmer.less +13 -5
  29. data/vendor/assets/stylesheets/semantic-ui/modules/dropdown.less +48 -8
  30. data/vendor/assets/stylesheets/semantic-ui/modules/modal.less +72 -13
  31. data/vendor/assets/stylesheets/semantic-ui/modules/rating.less +38 -35
  32. data/vendor/assets/stylesheets/semantic-ui/modules/search.less +1 -1
  33. data/vendor/assets/stylesheets/semantic-ui/modules/tab.less +1 -1
  34. data/vendor/assets/stylesheets/semantic-ui/modules/transition.less +283 -25
  35. data/vendor/assets/stylesheets/semantic-ui/views/list.less +24 -2
  36. metadata +3 -7
  37. data/lib/generators/semantic/install/templates/semantic-ui/collections.less +0 -6
  38. data/lib/generators/semantic/install/templates/semantic-ui/elements.less +0 -12
  39. data/lib/generators/semantic/install/templates/semantic-ui/modules.less +0 -16
  40. data/lib/generators/semantic/install/templates/semantic-ui/views.less +0 -6
  41. data/vendor/assets/stylesheets/semantic-ui/views/statistic.css +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ef14f24bab304510a353adf91ae0644cc05106c
4
- data.tar.gz: 935897b528a029ed51b0136a942a8e02cd8a62ee
3
+ metadata.gz: a0619645542d53d7ba86017cab7686914e76be7e
4
+ data.tar.gz: cca97df6f90407c2f82b1a3de07b61dcd38b00e2
5
5
  SHA512:
6
- metadata.gz: 132580d4160e6ec3be65869ba7f26dce9a7307cb81e83ff78110652360d4c8acbd3ae99fcc71378b5de41b99848507561115482a054eb3bd115821d547f1df78
7
- data.tar.gz: c53bb48b57cc09700d112759a47acb04964cdf58175e13addc7ab51bfb1334e94b34baaa4bcd53e2c4a82e50f34aa5d9fa76485cac99daeb5fc9aadfbc07cce7
6
+ metadata.gz: 38ac19ed870bb42c50f8920bc0d0c1fd4dfa511b713cb901eb5aa4299098e364eac49cca77943ba2e60d5deb8fcabc5aa15ffe14c96548d8dd86a658adba11eb
7
+ data.tar.gz: e6e66609ddb156137c428887bce32a33e02178cdcbe99805949e521438ebffed20f4fc5a10532dd0f04219b2b6c7a91b0c571512fd24073198b26afd8464fff3
@@ -20,15 +20,15 @@ module Semantic
20
20
  end
21
21
 
22
22
  # copy less manifests
23
- css_manifests = 'app/assets/stylesheets/semantic-ui'
23
+ css_manifests = 'app/assets/stylesheets/semantic-ui.css.less'
24
24
 
25
- if File.directory?(css_manifests)
25
+ if File.exist?(css_manifests)
26
26
  puts <<-EOM
27
27
  Notice:
28
28
  #{css_manifests} exist; skipping
29
29
  EOM
30
30
  else
31
- directory "semantic-ui", css_manifests, :recursive => true
31
+ copy_file "semantic-ui", "app/assets/stylesheets/semantic-ui.css.less"
32
32
  end
33
33
 
34
34
  end
@@ -0,0 +1,47 @@
1
+ /* Elements */
2
+ @import 'semantic-ui/elements/header.less';
3
+ @import 'semantic-ui/elements/progress.less';
4
+ @import 'semantic-ui/elements/segment.less';
5
+ @import 'semantic-ui/elements/loader.less';
6
+ @import 'semantic-ui/elements/step.less';
7
+ @import 'semantic-ui/elements/button.less';
8
+ @import 'semantic-ui/elements/input.less';
9
+ @import 'semantic-ui/elements/label.less';
10
+ @import 'semantic-ui/elements/divider.less';
11
+ @import 'semantic-ui/elements/image.less';
12
+ @import 'semantic-ui/elements/basic.icon.less';
13
+ @import 'semantic-ui/elements/icon.less';
14
+
15
+ /* Collections */
16
+ @import 'semantic-ui/collections/table.less';
17
+ @import 'semantic-ui/collections/breadcrumb.less';
18
+ @import 'semantic-ui/collections/message.less';
19
+ @import 'semantic-ui/collections/grid.less';
20
+ @import 'semantic-ui/collections/menu.less';
21
+ @import 'semantic-ui/collections/form.less';
22
+
23
+ /* Views */
24
+ @import 'semantic-ui/views/list.less';
25
+ @import 'semantic-ui/views/comment.less';
26
+ @import 'semantic-ui/views/item.less';
27
+ @import 'semantic-ui/views/statistic.less';
28
+ @import 'semantic-ui/views/feed.less';
29
+
30
+ /* Modules */
31
+ @import 'semantic-ui/modules/popup.less';
32
+ @import 'semantic-ui/modules/dimmer.less';
33
+ @import 'semantic-ui/modules/rating.less';
34
+ @import 'semantic-ui/modules/accordion.less';
35
+ @import 'semantic-ui/modules/transition.less';
36
+ @import 'semantic-ui/modules/checkbox.less';
37
+ @import 'semantic-ui/modules/search.less';
38
+ @import 'semantic-ui/modules/video.less';
39
+ @import 'semantic-ui/modules/nag.less';
40
+ @import 'semantic-ui/modules/shape.less';
41
+ @import 'semantic-ui/modules/modal.less';
42
+ @import 'semantic-ui/modules/sidebar.less';
43
+ @import 'semantic-ui/modules/reveal.less';
44
+ @import 'semantic-ui/modules/tab.less';
45
+ @import 'semantic-ui/modules/dropdown.less';
46
+ @import 'semantic-ui/modules/chatroom.less';
47
+
@@ -1,7 +1,7 @@
1
1
  module Semantic
2
2
  module Ui
3
3
  module Rails
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -24,8 +24,7 @@ class Semantic < Thor
24
24
 
25
25
  parse_version
26
26
  copy_files
27
- fix_fonts_paths
28
- fix_images_paths
27
+ fix_paths
29
28
  generate_templates
30
29
  end
31
30
 
@@ -39,9 +38,13 @@ class Semantic < Thor
39
38
  end
40
39
 
41
40
  def pull
42
- say_status "STEP", "PULL REPO"
43
- git = Git.open(git_root, :log => Logger.new(STDOUT))
44
- git.pull
41
+ begin
42
+ say_status "STEP", "PULL REPO"
43
+ git = Git.open(git_root, :log => Logger.new(STDOUT))
44
+ git.pull
45
+ rescue
46
+ puts "no internet connection"
47
+ end
45
48
  end
46
49
 
47
50
  def parse_version
@@ -56,13 +59,10 @@ class Semantic < Thor
56
59
  gsub_file version_file, /(?<=VERSION = \")(.+)(?=\")/, version
57
60
  end
58
61
 
59
- def fix_fonts_paths
60
- gsub_file source_root + 'vendor/assets/stylesheets/semantic-ui/elements/icon.less', /(?<=url\()(.+\/fonts)(?=\/)/, '/assets/semantic-ui'
61
- gsub_file source_root + 'vendor/assets/stylesheets/semantic-ui/elements/basic.icon.less', /(?<=url\()(.+\/fonts)(?=\/)/, '/assets/semantic-ui'
62
- end
63
-
64
- def fix_images_paths
65
- # TODO: do it
62
+ def fix_paths
63
+ Dir.glob(source_root + "vendor" + "**/*.less") do |file|
64
+ gsub_file file, /(?<=url\()(.+\/\w+)(?=\/)/, '/assets/semantic-ui'
65
+ end
66
66
  end
67
67
 
68
68
  def copy_files
@@ -107,26 +107,30 @@ class Semantic < Thor
107
107
  end
108
108
 
109
109
  # STYLESHEETS
110
- say_status "STEP", "GENERATE STYLESHEETS TEMPLATES"
111
- css_template_path = source_root + "lib/generators/semantic/install/templates/semantic-ui/"
110
+ say_status "STEP", "GENERATE STYLESHEETS TEMPLATE"
111
+ css_template_path = source_root + "lib/generators/semantic/install/templates/semantic-ui.css.less"
112
112
 
113
- stylesheets_path = Pathname.new(source_root + "vendor/assets/stylesheets/semantic-ui")
113
+ stylesheets = Pathname.new(source_root + "vendor/assets/stylesheets/semantic-ui")
114
114
 
115
- FileUtils.rm_rf Dir.glob css_template_path + "*.*"
115
+ FileUtils.rm css_template_path
116
116
 
117
- Dir.glob stylesheets_path + "**/*" do |file|
118
- if File.directory? file
119
- File.open(css_template_path + (Pathname.new(file).basename.to_s + ".less"), 'a') do |template|
120
- Dir.glob(stylesheets_path + file + "**/*") do |file|
121
- next if File.directory? file
117
+ dirs_order = %w(elements collections views modules)
122
118
 
123
- filepath = Pathname.new(file)
119
+ File.open(css_template_path, 'a') do |template|
120
+ dirs_order.each do |dir|
121
+ template.write "/* #{dir.capitalize} */ \n"
124
122
 
125
- relative_path = filepath.relative_path_from(stylesheets_path)
123
+ Dir.glob(source_root + stylesheets + dir + "**/*") do |file|
124
+ next if File.directory? file
126
125
 
127
- template.write "@import 'semantic-ui/#{relative_path}'; \n"
128
- end
126
+ filepath = Pathname.new(file)
127
+
128
+ relative_path = filepath.relative_path_from(stylesheets)
129
+
130
+ template.write "@import 'semantic-ui/#{relative_path}'; \n"
129
131
  end
132
+
133
+ template.write "\n"
130
134
  end
131
135
  end
132
136
  end
@@ -87,8 +87,10 @@ $.fn.accordion = function(parameters) {
87
87
  resetStyle: function() {
88
88
  module.verbose('Resetting styles on element', this);
89
89
  $(this)
90
+ .attr('style', '')
90
91
  .removeAttr('style')
91
92
  .children()
93
+ .attr('style', '')
92
94
  .removeAttr('style')
93
95
  ;
94
96
  }
@@ -138,8 +140,10 @@ $.fn.accordion = function(parameters) {
138
140
  .slideUp(settings.duration , settings.easing, function() {
139
141
  $previousContent
140
142
  .removeClass(className.active)
143
+ .attr('style', '')
141
144
  .removeAttr('style')
142
145
  .children()
146
+ .attr('style', '')
143
147
  .removeAttr('style')
144
148
  ;
145
149
  })
@@ -151,11 +155,13 @@ $.fn.accordion = function(parameters) {
151
155
  $activeContent
152
156
  .stop()
153
157
  .children()
158
+ .attr('style', '')
154
159
  .removeAttr('style')
155
160
  .end()
156
161
  .slideDown(settings.duration, settings.easing, function() {
157
162
  $activeContent
158
163
  .addClass(className.active)
164
+ .attr('style', '')
159
165
  .removeAttr('style')
160
166
  ;
161
167
  $.proxy(settings.onOpen, $activeContent)();
@@ -185,6 +191,7 @@ $.fn.accordion = function(parameters) {
185
191
  .end()
186
192
  .slideUp(settings.duration, settings.easing, function(){
187
193
  $activeContent
194
+ .attr('style', '')
188
195
  .removeAttr('style')
189
196
  ;
190
197
  $.proxy(settings.onClose, $activeContent)();
@@ -574,7 +574,7 @@ $.fn.chatroom = function(parameters) {
574
574
  if(instance === undefined) {
575
575
  module.initialize();
576
576
  }
577
- invokedResponse = module.invoke(query);
577
+ module.invoke(query);
578
578
  }
579
579
  else {
580
580
  if(instance !== undefined) {
@@ -104,7 +104,7 @@ $.fn.checkbox = function(parameters) {
104
104
  },
105
105
 
106
106
  enable: function() {
107
- module.debug('Enabling checkbox');
107
+ module.debug('Enabling checkbox', $input);
108
108
  $input
109
109
  .prop('checked', true)
110
110
  ;
@@ -218,9 +218,6 @@ $.fn.checkbox = function(parameters) {
218
218
  if(moduleSelector) {
219
219
  title += ' \'' + moduleSelector + '\'';
220
220
  }
221
- if($allModules.size() > 1) {
222
- title += ' ' + '(' + $allModules.size() + ')';
223
- }
224
221
  if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
225
222
  console.groupCollapsed(title);
226
223
  if(console.table) {
@@ -334,7 +331,7 @@ $.fn.checkbox.settings = {
334
331
  },
335
332
 
336
333
  selector : {
337
- input : 'input',
334
+ input : 'input[type=checkbox], input[type=radio]',
338
335
  label : 'label'
339
336
  },
340
337
 
@@ -44,46 +44,56 @@ $.fn.dimmer = function(parameters) {
44
44
  $allModules
45
45
  .each(function() {
46
46
  var
47
- $module = $(this),
48
- $dimmer = $module.children(selector.dimmer).first(),
47
+ $module = $(this),
48
+ $dimmer,
49
+ $dimmable,
49
50
 
50
- element = this,
51
- instance = $dimmer.data(moduleNamespace),
51
+ element = this,
52
+ instance = $module.data(moduleNamespace),
52
53
  module
53
54
  ;
54
55
 
55
- module = {
56
+ module = {
56
57
 
57
- initialize: function() {
58
+ preinitialize: function() {
58
59
  if( module.is.dimmer() ) {
59
- $dimmer = $module;
60
- $module = $dimmer.parent();
61
- module.debug('Module initialized as dimmer', settings);
60
+ $dimmable = $module.parent();
61
+ $dimmer = $module;
62
62
  }
63
63
  else {
64
+ $dimmable = $module;
64
65
  if( module.has.dimmer() ) {
65
- $dimmer = $module.children(selector.dimmer).first();
66
- module.debug('Module initialized with found dimmer', settings);
66
+ $dimmer = $dimmable.children(selector.dimmer).first();
67
67
  }
68
68
  else {
69
69
  module.create();
70
- module.debug('Module initialized with created dimmer', settings);
71
- }
72
- if(settings.on == 'hover') {
73
- $module
74
- .on('mouseenter' + eventNamespace, module.show)
75
- .on('mouseleave' + eventNamespace, module.hide)
76
- ;
77
- }
78
- else if(settings.on == 'click') {
79
- $module
80
- .on(clickEvent + eventNamespace, module.toggle)
81
- ;
82
70
  }
83
71
  }
72
+ },
73
+
74
+ initialize: function() {
75
+ module.debug('Initializing dimmer', settings);
76
+ if(settings.on == 'hover') {
77
+ $dimmable
78
+ .on('mouseenter' + eventNamespace, module.show)
79
+ .on('mouseleave' + eventNamespace, module.hide)
80
+ ;
81
+ }
82
+ else if(settings.on == 'click') {
83
+ $dimmable
84
+ .on(clickEvent + eventNamespace, module.toggle)
85
+ ;
86
+ }
87
+
88
+ if( module.is.page() ) {
89
+ module.debug('Setting as a page dimmer', $dimmable);
90
+ module.set.pageDimmer();
91
+ }
92
+
84
93
  if(settings.closable) {
94
+ module.verbose('Adding dimmer close event', $dimmer);
85
95
  $dimmer
86
- .on(clickEvent, module.event.click)
96
+ .on(clickEvent + eventNamespace, module.event.click)
87
97
  ;
88
98
  }
89
99
  module.set.dimmable();
@@ -91,16 +101,19 @@ $.fn.dimmer = function(parameters) {
91
101
  },
92
102
 
93
103
  instantiate: function() {
94
- module.verbose('Storing instance of module');
104
+ module.verbose('Storing instance of module', module);
95
105
  instance = module;
96
- $dimmer
106
+ $module
97
107
  .data(moduleNamespace, instance)
98
108
  ;
99
109
  },
100
110
 
101
111
  destroy: function() {
102
- module.verbose('Destroying previous module');
103
- $module
112
+ module.verbose('Destroying previous module', $dimmer);
113
+ $dimmable
114
+ .off(eventNamespace)
115
+ ;
116
+ $dimmer
104
117
  .off(eventNamespace)
105
118
  ;
106
119
  },
@@ -117,16 +130,21 @@ $.fn.dimmer = function(parameters) {
117
130
 
118
131
  },
119
132
 
120
- create: function() {
121
- $dimmer = settings.template.dimmer();
122
- $dimmer
123
- .appendTo($module)
133
+ addContent: function(element) {
134
+ var
135
+ $content = $(element).detach()
124
136
  ;
125
- if(module.is.page()) {
126
- module.set.pageDimmer();
137
+ module.debug('Add content to dimmer', $content);
138
+ if($content.parent()[0] !== $dimmer[0]) {
139
+ $dimmer.append($content);
127
140
  }
128
141
  },
129
142
 
143
+ create: function() {
144
+ $dimmer = $( settings.template.dimmer() );
145
+ return $dimmer.appendTo($dimmable);
146
+ },
147
+
130
148
  animate: {
131
149
  show: function(callback) {
132
150
  callback = callback || function(){};
@@ -182,6 +200,12 @@ $.fn.dimmer = function(parameters) {
182
200
  }
183
201
  },
184
202
 
203
+ get: {
204
+ dimmer: function() {
205
+ return $dimmer;
206
+ }
207
+ },
208
+
185
209
  has: {
186
210
  dimmer: function() {
187
211
  return ( $module.children(selector.dimmer).size() > 0 );
@@ -189,26 +213,26 @@ $.fn.dimmer = function(parameters) {
189
213
  },
190
214
 
191
215
  is: {
216
+ dimmer: function() {
217
+ return $module.is(selector.dimmer);
218
+ },
219
+ dimmable: function() {
220
+ return $module.is(selector.dimmable);
221
+ },
192
222
  active: function() {
193
223
  return $dimmer.hasClass(className.active);
194
224
  },
195
225
  animating: function() {
196
226
  return ( $dimmer.is(':animated') || $dimmer.hasClass(className.transition) );
197
227
  },
198
- dimmer: function() {
199
- return $module.is(selector.dimmer);
200
- },
201
228
  page: function () {
202
- return $module.is('body');
203
- },
204
- dimmable: function() {
205
- return $module.is(selector.dimmable);
229
+ return $dimmable.is('body');
206
230
  },
207
231
  enabled: function() {
208
- return !$module.hasClass(className.disabled);
232
+ return !$dimmable.hasClass(className.disabled);
209
233
  },
210
234
  disabled: function() {
211
- return $module.hasClass(className.disabled);
235
+ return $dimmable.hasClass(className.disabled);
212
236
  },
213
237
  pageDimmer: function() {
214
238
  return $dimmer.hasClass(className.pageDimmer);
@@ -229,12 +253,10 @@ $.fn.dimmer = function(parameters) {
229
253
  ;
230
254
  },
231
255
  dimmable: function() {
232
- $module
233
- .addClass(className.dimmable)
234
- ;
256
+ $dimmable.addClass(className.dimmable);
235
257
  },
236
258
  dimmed: function() {
237
- $module.addClass(className.dimmed);
259
+ $dimmable.addClass(className.dimmed);
238
260
  },
239
261
  pageDimmer: function() {
240
262
  $dimmer.addClass(className.pageDimmer);
@@ -252,7 +274,7 @@ $.fn.dimmer = function(parameters) {
252
274
  ;
253
275
  },
254
276
  dimmed: function() {
255
- $module.removeClass(className.dimmed);
277
+ $dimmable.removeClass(className.dimmed);
256
278
  },
257
279
  disabled: function() {
258
280
  $dimmer.removeClass(className.disabled);
@@ -260,7 +282,7 @@ $.fn.dimmer = function(parameters) {
260
282
  },
261
283
 
262
284
  show: function(callback) {
263
- module.debug('Showing dimmer', $dimmer);
285
+ module.debug('Showing dimmer', $dimmer, settings);
264
286
  if( !(module.is.active() || module.is.animating() ) && module.is.enabled() ) {
265
287
  module.animate.show(callback);
266
288
  $.proxy(settings.onShow, element)();
@@ -454,6 +476,8 @@ $.fn.dimmer = function(parameters) {
454
476
  }
455
477
  };
456
478
 
479
+ module.preinitialize();
480
+
457
481
  if(methodInvoked) {
458
482
  if(instance === undefined) {
459
483
  module.initialize();