gluttonberg-core 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -409,7 +409,8 @@ module ActionView
409
409
 
410
410
  def datetime_field(field_name,date_field_html_opts = {},time_field_html_opts = {})
411
411
  date_field_html_opts["data-datepicker"] = "bsdatepicker"
412
- date_field_html_opts[:onblur] = "checkDateFormat(this,'.#{field_name}_error');combine_datetime('#{field_name}');"
412
+ unique_field_name = "#{field_name}_#{Gluttonberg::Member.generateRandomString}"
413
+ date_field_html_opts[:onblur] = "checkDateFormat(this,'.#{unique_field_name}_error');combine_datetime('#{unique_field_name}');"
413
414
  if date_field_html_opts[:class].blank?
414
415
  date_field_html_opts[:class] = "small datefield"
415
416
 
@@ -422,7 +423,7 @@ module ActionView
422
423
  else
423
424
  time_field_html_opts[:class] += " timefield"
424
425
  end
425
- time_field_html_opts[:onblur] = "checkTimeFormat(this,'.#{field_name}_error');combine_datetime('#{field_name}')"
426
+ time_field_html_opts[:onblur] = "checkTimeFormat(this,'.#{unique_field_name}_error');combine_datetime('#{unique_field_name}')"
426
427
 
427
428
  html = ""
428
429
  date = ""
@@ -431,15 +432,15 @@ module ActionView
431
432
  date = self.object.send(field_name).strftime("%d/%m/%Y")
432
433
  time = self.object.send(field_name).strftime("%I:%M %p")
433
434
  end
434
- html += text_field_tag("#{field_name}_date" , date , date_field_html_opts )
435
+ html += text_field_tag("#{unique_field_name}_date" , date , date_field_html_opts )
435
436
  html += "<span class='date'>DD/MM/YYYY</span>"
436
437
  html += " "
437
- html += text_field_tag("#{field_name}_time" , time , time_field_html_opts )
438
+ html += text_field_tag("#{unique_field_name}_time" , time , time_field_html_opts )
438
439
  html += "<span class='date time'>HH:MM AM/PM</span>"
439
- html += self.hidden_field("#{field_name}" , :class => "#{field_name}")
440
- html += "<label class='error #{field_name}_error'></label>"
440
+ html += self.hidden_field("#{field_name}" , :class => "#{unique_field_name}")
441
+ html += "<label class='error #{unique_field_name}_error'></label>"
441
442
  html += "<div class='clear'></div>"
442
- html += "<script type='text/javascript'>$(document).ready(function() { combine_datetime('#{field_name}'); }); </script>"
443
+ html += "<script type='text/javascript'>$(document).ready(function() { combine_datetime('#{unique_field_name}'); }); </script>"
443
444
  html.html_safe
444
445
  end
445
446
 
@@ -52,13 +52,16 @@
52
52
  = active_link_to("Dashboard", admin_root_path, :id => "dashboard_nav" , :title => "Dashboard", :active => params[:controller].include?('gluttonberg/admin/main'))
53
53
  %li
54
54
  = active_link_to("Content", admin_pages_path, :id => "content_nav" , :title => "Content", :active => (params[:controller].include?('gluttonberg/admin/content') || (( Gluttonberg::Components.nav_entries.collect{|c| c[1]}).include?(controller_name.to_sym) )))
55
- %li
56
- = active_link_to("Library", admin_asset_category_path(:category => 'all' , :page => 1 ), :id => "library_nav" , :title => "Library" , :active => params[:controller].include?('gluttonberg/admin/asset_library') )
57
55
 
58
56
  - for entry in Gluttonberg::Components.main_nav_entries
59
57
  -if entry[2].blank? || entry[2]==false || (entry[2]==true && session.user.is_super_admin)
60
58
  %li{:class => "custom"}
61
59
  = active_link_to(entry[0], url_for(entry[1]), :id => (entry[0].to_s.underscore).gsub(/\s/, '_') + "Nav" , :title => entry[0] )
60
+
61
+ %li
62
+ = active_link_to("Library", admin_asset_category_path(:category => 'all' , :page => 1 ), :id => "library_nav" , :title => "Library" , :active => params[:controller].include?('gluttonberg/admin/asset_library') )
63
+
64
+
62
65
  - if Gluttonberg::Member.enable_members == true
63
66
  %li
64
67
  = active_link_to("Members", admin_membership_members_path, :id => "membership_nav" , :title => "Members" , :active => /^\/admin\/membership/)
@@ -10,21 +10,21 @@ module Gluttonberg
10
10
  klass.class_eval do
11
11
  extend ClassMethods
12
12
  include InstanceMethods
13
-
13
+
14
14
  before_validation :slug_management
15
15
  class << self; attr_accessor :slug_source_field_name end
16
16
  attr_accessor :current_slug
17
-
18
-
17
+
18
+
19
19
  end
20
20
  end
21
-
21
+
22
22
  module ClassMethods
23
-
23
+
24
24
  end
25
-
25
+
26
26
  module InstanceMethods
27
-
27
+
28
28
  def get_slug_source
29
29
  if self.class.slug_source_field_name.blank?
30
30
  if self.respond_to?(:name)
@@ -37,19 +37,19 @@ module Gluttonberg
37
37
  end
38
38
  self.class.slug_source_field_name
39
39
  end
40
-
40
+
41
41
  def slug=(new_slug)
42
42
  #if you're changing this regex, make sure to change the one in /javascripts/slug_management.js too
43
43
  # utf-8 special chars are fixed for new ruby 1.9.2
44
44
  unless new_slug.blank?
45
- new_slug = new_slug.downcase.gsub(/\s/, '_').gsub(/[\!\*'"″′‟‛„‚”“”˝\(\)\;\:\.\@\&\=\+\$\,\/?\%\#\[\]]/, '')
45
+ new_slug = new_slug.to_s.downcase.gsub(/\s/, '_').gsub(/[\!\*'"″′‟‛„‚”“”˝\(\)\;\:\.\@\&\=\+\$\,\/?\%\#\[\]]/, '')
46
46
  new_slug = new_slug.gsub('__','_') # remove consective underscores
47
47
  new_slug = new_slug.gsub(/_$/,'') # remove trailing underscore
48
- end
48
+ end
49
49
  write_attribute(:slug, new_slug)
50
50
  end
51
-
52
- protected
51
+
52
+ protected
53
53
  # Checks If slug is blank then tries to set slug using following logic
54
54
  # if slug_field_name is set then use its value and make it slug
55
55
  # otherwise checks for name column
@@ -77,12 +77,12 @@ module Gluttonberg
77
77
  if !already_exist.blank?
78
78
  if already_exist.length > 1 || (already_exist.length == 1 && already_exist.first.id != self.id )
79
79
  self.slug= "#{self.slug}_#{already_exist.length+1}"
80
- end
80
+ end
81
81
  end
82
82
  end
83
-
83
+
84
84
  end
85
-
85
+
86
86
  end
87
87
  end
88
88
  end
@@ -1,3 +1,3 @@
1
1
  module Gluttonberg
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gluttonberg-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-11-06 00:00:00.000000000 Z
15
+ date: 2012-11-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: authlogic