caboose-cms 0.6.30 → 0.6.31

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODMwZTNmNjZmMWZhNzdmZjBhOTNhZTQwMDk0OTEzOTI0MGVhOTMzYg==
4
+ YmE5Nzc5MGY3NWFjYTViZGZkMDc5NTkzMGU0MDQ3NjRmNjdmOGM0NQ==
5
5
  data.tar.gz: !binary |-
6
- N2Y2MGU4ODljYzNhMmFjMjNiZDk2ODcwOTg4ODI0NmRiOGYxNGI3Yg==
6
+ NzY2NTE4NmQ5MzE2ZWY4OGU2MzI0ZWVkNGUzZjNlYjA5YWVmNjA5Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmI5NDc3NDIxZTdhODkzMzNjMTIzMDMxZTYwMzY3M2Q2NTVmYWQ5Nzc3N2M2
10
- YTk4M2QzZDNjOWEwZmNiYTFlYTcyNGM4MDk5ZmFjMjUxZjRhOTA1NjkwNDRl
11
- YmE2NjI4ZTZhZWVkYTQwMjM2OWM3NDY2Y2ExOTBiNThjNWY5OTA=
9
+ YjY0MWY1MDQwMzE4MmRhMDAzMmViZDFhYmNjYjJhNThjODk1ZjYwOTc3NDZm
10
+ ODM3MWFlNjQzOGUzMTg5YmQ4YTgyN2I4ZDY0ZmUwNzgxMzg1ZjBiMWMzYWM1
11
+ MjlhYTdkY2ZiOWViYjE5NTJjYmRiY2UwM2ZkZDc3ZDMyMTRkOGQ=
12
12
  data.tar.gz: !binary |-
13
- MzAzZjIzMDgzZDBmM2I3OWU3MGY5YzIyMTQ0NTMzODFhMWJiNDZiYmNiM2Ex
14
- YjY5YTBjMWZiYjU3OGQ5M2UxMzEwYmRiY2RiZDUyZjgxMGNmM2YzNmVmNDZm
15
- MjA5OTM4MjZmOGJiODVjMmJlNjZhY2U0NGNkMTYxMzc5Y2I0NjU=
13
+ YWQ0OWYxNjAwZmY3ZWI2NTIyNmUyYWI5OWExZjVlN2EzOTEzZDhkYWE3NTlh
14
+ ODFlZWFiZDI5MWZiZTlmZTY3MmRhMGZhN2Y3NGUwZTU5YzAzNjFkMjVmMDNi
15
+ MGEzYzU2ZDEwMjIwNWU4NGY3Njk3ZTFlMWJlNzcwYzQ5MzAzNjY=
@@ -804,24 +804,29 @@ IndexTable.prototype = {
804
804
  },
805
805
 
806
806
  current_message: false,
807
- show_message: function(el, name) {
807
+ show_message: function(el, name, after) {
808
808
  var that = this;
809
809
  if (that.current_message == name)
810
810
  {
811
811
  $('#' + that.container + '_message').slideUp(function() { $('#' + that.container + '_message').empty().css('margin-bottom', 0); });
812
812
  that.current_message = false;
813
+ if (after) after();
813
814
  return;
814
815
  }
815
816
  if (!$('#' + that.container + '_message').is(':empty'))
816
817
  {
817
- $('#' + that.container + '_message').slideUp(function() { $('#' + that.container + '_message').empty().append(el).css('margin-bottom', '10px').slideDown(); });
818
- that.current_message = name;
818
+ $('#' + that.container + '_message').slideUp(function() {
819
+ $('#' + that.container + '_message').empty().append(el).css('margin-bottom', '10px').slideDown();
820
+ if (after) after();
821
+ });
822
+ that.current_message = name;
819
823
  return;
820
824
  }
821
825
  else
822
826
  {
823
827
  $('#' + that.container + '_message').hide().empty().append(el).css('margin-bottom', '10px').slideDown();
824
828
  that.current_message = name;
829
+ if (after) after();
825
830
  }
826
831
  },
827
832
 
@@ -830,11 +835,16 @@ IndexTable.prototype = {
830
835
  var that = this;
831
836
  var form = $('<form/>').attr('id', 'new_form')
832
837
  .append($('<input/>').attr('type', 'hidden').attr('name', 'authenticity_token').val(that.form_authenticity_token));
838
+ var focus_field = false;
833
839
  $.each(this.new_model_fields, function(i, f) {
834
840
  if (f.type == 'hidden')
835
841
  form.append($('<input/>').attr('type', 'hidden').attr('name', f.name).val(f.value));
836
842
  else
843
+ {
837
844
  form.append($('<p/>').append($('<input/>').attr('type', 'text').attr('name', f.name).attr('placeholder', f.nice_name).css('width', '' + f.width + 'px')));
845
+ if (!focus_field)
846
+ focus_field = f.name;
847
+ }
838
848
  });
839
849
  form.append($('<div/>').attr('id', that.container + '_new_message'));
840
850
  form.append($('<p>')
@@ -843,8 +853,8 @@ IndexTable.prototype = {
843
853
  );
844
854
  var div = $('<div/>').addClass('note')
845
855
  .append($('<h2/>').css('margin-top', 0).css('padding-top', 0).html(that.new_model_text))
846
- .append(form);
847
- that.show_message(div);
856
+ .append(form);
857
+ that.show_message(div, null, function() { $('#new_form input[name="' + focus_field + '"]').focus(); });
848
858
  },
849
859
 
850
860
  add_model: function()
@@ -19,30 +19,23 @@ module Caboose
19
19
  if line =~ /^(.*?)class (.*?)Controller(.*?)$/
20
20
  class_name = line.gsub(/^(.*?)class (.*?)Controller(.*?)$/, '\2').gsub(/([A-Z])/, '_\1').downcase
21
21
  class_name[0] = '' if class_name[0] == '_'
22
- next
23
- end
24
- if line =~ /# CLASS PRIORITY: \d/
25
- class_priority = line.gsub(/# ROUTES PRIORITY: (\d*?)$/, '\1').to_i
26
- next
27
- end
28
- if line =~ /# ROUTE PRIORITY: \d/
29
- route_priority = line.gsub(/# ROUTE PRIORITY: (\d*?)$/, '\1').to_i
30
- next
31
- end
32
- if line.starts_with?('def ')
22
+ elsif line =~ /# @class_route_priority \d/
23
+ class_priority = line.gsub(/# @class_route_priority (\d*?)$/, '\1').to_i
24
+ elsif line =~ /# @route_priority \d/
25
+ route_priority = line.gsub(/# @route_priority (\d*?)$/, '\1').to_i
26
+ elsif line.starts_with?('def ')
33
27
  actions << [line.gsub('def ', ''), uris, route_priority]
34
28
  uris = []
35
29
  route_priority = 20
36
- end
37
- if line =~ /# GET (.*?)/ then uris << "get \"#{line.gsub(/# GET (.*?)/ , '\1')}\""
38
- elsif line =~ /# POST (.*?)/ then uris << "post \"#{line.gsub(/# POST (.*?)/ , '\1')}\""
39
- elsif line =~ /# PUT (.*?)/ then uris << "put \"#{line.gsub(/# PUT (.*?)/ , '\1')}\""
40
- elsif line =~ /# DELETE (.*?)/ then uris << "delete \"#{line.gsub(/# DELETE (.*?)/ , '\1')}\""
30
+ elsif line =~ /# @route GET (.*?)/ then uris << "get \"#{line.gsub(/# @route GET (.*?)/ , '\1')}\""
31
+ elsif line =~ /# @route POST (.*?)/ then uris << "post \"#{line.gsub(/# @route POST (.*?)/ , '\1')}\""
32
+ elsif line =~ /# @route PUT (.*?)/ then uris << "put \"#{line.gsub(/# @route PUT (.*?)/ , '\1')}\""
33
+ elsif line =~ /# @route DELETE (.*?)/ then uris << "delete \"#{line.gsub(/# @route DELETE (.*?)/ , '\1')}\""
41
34
  end
42
35
  end
43
36
  classes << [class_name, actions, class_priority]
44
37
  end
45
- puts "--------------------------------------------------------------------"
38
+
46
39
  routes = []
47
40
  classes.sort_by{ |arr| arr[2] }.each do |carr|
48
41
 
@@ -51,11 +44,7 @@ module Caboose
51
44
 
52
45
  # Get the longest URI so we can make routes that line up vertically
53
46
  longest = ''
54
- actions.each do |action, uris|
55
- uris.each do |uri|
56
- longest = uri if uri.length > longest.length
57
- end
58
- end
47
+ actions.each{ |action, uris| uris.each{ |uri| longest = uri if uri.length > longest.length }}
59
48
  length = longest.length + 1
60
49
 
61
50
  # Make the route line
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.6.30'
2
+ VERSION = '0.6.31'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.30
4
+ version: 0.6.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg