gluttonberg-core 2.5 → 2.5.1

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.
@@ -146,7 +146,7 @@ module Gluttonberg
146
146
  options[:alt] = asset.alt.blank? ? asset.name : asset.alt
147
147
  end
148
148
  options[:src] = path
149
- tag(:img , "" , options)
149
+ tag("img" , options)
150
150
  end
151
151
  end
152
152
 
@@ -157,7 +157,7 @@ module Gluttonberg
157
157
  options[:alt] = asset.name
158
158
  options[:title] = asset.name
159
159
  options[:src] = thumbnail_type.blank? ? asset.url : asset.url_for(thumbnail_type)
160
- tag(:img , "" , options)
160
+ tag("img" , options)
161
161
  end
162
162
  end
163
163
 
@@ -241,7 +241,7 @@ module ActionView
241
241
  def asset_tag(asset , thumbnail_type = nil)
242
242
  unless asset.blank?
243
243
  path = thumbnail_type.blank? ? asset.url : asset.url_for(thumbnail_type)
244
- tag(:img , "", :class => asset.name , :alt => asset.name , :src => path)
244
+ tag(:img , :class => asset.name , :alt => asset.name , :src => path)
245
245
  end
246
246
  end
247
247
 
@@ -10,6 +10,12 @@ module Gluttonberg
10
10
  acts_as_taggable_on :locations , :characters , :themes, :photographers
11
11
 
12
12
  include Library::AttachmentMixin
13
+ asset_mixins = Rails.configuration.asset_mixins
14
+ unless asset_mixins.blank?
15
+ asset_mixins.each do |mixin|
16
+ include mixin
17
+ end
18
+ end
13
19
 
14
20
  has_and_belongs_to_many :asset_collections , :join_table => "gb_asset_collections_assets"
15
21
  belongs_to :asset_type
@@ -17,7 +23,9 @@ module Gluttonberg
17
23
 
18
24
  belongs_to :user
19
25
 
20
- attr_accessible :file, :name, :alt, :asset_collection_ids, :mime_type, :description, :synopsis, :copyrights, :year_of_production, :duration, :width, :height, :alt , :processed, :copied_to_s3
26
+ attr_accessible :file, :name, :alt, :asset_collection_ids, :mime_type
27
+ attr_accessible :description, :synopsis, :copyrights, :year_of_production, :duration
28
+ attr_accessible :artist_name, :link, :width, :height, :alt , :processed, :copied_to_s3
21
29
 
22
30
  # constants for formatted file size
23
31
  GIGA_SIZE = 1073741824.0
@@ -11,9 +11,14 @@ module Gluttonberg
11
11
 
12
12
  validates_presence_of :first_name , :email
13
13
  attr_accessor :return_url , :term_and_conditions
14
-
15
14
  attr_accessor :image_delete
16
15
 
16
+ member_mixins = Rails.configuration.member_mixins
17
+ unless member_mixins.blank?
18
+ member_mixins.each do |mixin|
19
+ include mixin
20
+ end
21
+ end
17
22
 
18
23
  clean_html [:bio]
19
24
 
@@ -1,7 +1,7 @@
1
1
  .row-fluid
2
2
  = form_for( @asset , :as => :asset , :url => url_opts , :html => { :multipart=>true , :method => method_name, :class => "nosubnav validation"} ) do |asset_form|
3
3
  = gb_error_messages_for(@asset)
4
-
4
+
5
5
  - unless @asset.thumb_large_url.blank?
6
6
  %p
7
7
  %img{:src => @asset.thumb_large_url}
@@ -18,12 +18,25 @@
18
18
  %p
19
19
  = asset_form.label :alt , "Description"
20
20
  = asset_form.text_field(:alt, :class => "large" , :maxlength => 255 )
21
- .span6
21
+ - if Rails.configuration.enable_gallery == true
22
+ .help
23
+ "Description" field is also used for image caption in photo galleries.
24
+ %p
25
+ = asset_form.label :artist_name
26
+ = asset_form.text_field(:artist_name, :class => "large" , :maxlength => 255 )
27
+
22
28
  - if Rails.configuration.enable_gallery == true
23
- .help
24
- "Description" field is also used for image caption in photo galleries.
29
+ %p
30
+ = asset_form.label :link
31
+ = asset_form.text_field(:link, :class => "large" , :maxlength => 255 )
32
+
33
+ - if Rails.configuration.enable_gallery == true
34
+ .help
35
+ "link" field is also used for image target url in photo galleries.
36
+ .span6
37
+
25
38
  = render :partial => "collection_select_form" , :locals => {:asset_form => asset_form }
26
-
39
+
27
40
  .row-fluid
28
41
  .span6
29
42
  %legend Publish
@@ -6,6 +6,19 @@
6
6
  = gb_error_messages_for(@article_localization)
7
7
  .span5
8
8
  .tabbable
9
+ .versions.page_content_form
10
+ - unless action_name == "new" || action_name == "create"
11
+ - if Gluttonberg.localized? && Gluttonberg::Locale.all.length > 1
12
+ .btn-group
13
+ %a{ :class => "btn dropdown-toggle" , "data-toggle" => "dropdown", :href => "#"}
14
+ Editing #{@article_localization.locale.name} Content
15
+ %span.caret
16
+ %ul.dropdown-menu
17
+ - for locale in Gluttonberg::Locale.all
18
+ - localization = Gluttonberg::ArticleLocalization.find(:first , :conditions => { :article_id => @article.id , :locale_id => locale.id } )
19
+ %li
20
+ %a{:href => edit_admin_blog_article_path(@blog, @article , :localization_id => localization.id) ,:id=>"edit_content_tab",:class=>"button"}
21
+ = "Edit #{localization.locale.name}"
9
22
  %ul.nav.nav-tabs
10
23
  %li.active
11
24
  %a{:href => "#content", "data-toggle" => "tab" }
@@ -17,14 +30,14 @@
17
30
  .tab-pane.active#content
18
31
  .pad
19
32
  %p
20
- = f.fields_for :article , @article do |article_form|
33
+ = f.fields_for :article , @article do |article_form|
21
34
  %p
22
35
  = article_form.hidden_field(:user_id, :value => current_user.id) if @article.user_id.blank?
23
36
  = article_form.hidden_field(:blog_id, :value => @blog.id) if @article.blog_id.blank?
24
37
  %p
25
38
  = f.label :title
26
39
  = f.text_field(:title, :id => "page_title" , :class => "required")
27
-
40
+
28
41
  %p
29
42
  #page_slug_holder
30
43
  %span.domain
@@ -35,15 +48,15 @@
35
48
  = f.text_field(:slug, :id => 'page_hidden_slug')
36
49
  .clear
37
50
 
38
-
39
- = f.fields_for :article , @article do |article_form|
51
+
52
+ = f.fields_for :article , @article do |article_form|
40
53
  %p
41
54
  = article_form.label :author
42
55
  = article_form.select("author_id" , @authors.collect{|a| [a.email , a.id] } , :class => "required" )
43
56
  %p
44
57
  = f.label :featured_image_id
45
- = f.asset_browser( :featured_image_id , opts = { :filter => "image" } )
46
-
58
+ = f.asset_browser( :featured_image_id , opts = { :filter => "image" } )
59
+
47
60
  %p
48
61
  = f.label :excerpt
49
62
  = f.text_area(:excerpt , :class => "jwysiwyg" )
@@ -53,7 +66,7 @@
53
66
 
54
67
  .tab-pane#seo
55
68
  .pad
56
- = f.fields_for :article , @article do |article_form|
69
+ = f.fields_for :article , @article do |article_form|
57
70
  .seo_body
58
71
  %p
59
72
  = article_form.label :slug
@@ -74,29 +87,29 @@
74
87
 
75
88
  .span4
76
89
 
77
- = f.fields_for :article , @article do |article_form|
90
+ = f.fields_for :article , @article do |article_form|
78
91
  %legend Categories & Tags
79
92
  %p
80
93
  = article_form.label :article_category_list , "Categories"
81
- = article_form.text_field(:article_category_list, :class => "tags" , :rel => tags_string("article_category") )
94
+ = article_form.text_field(:article_category_list, :class => "tags" , :rel => tags_string("article_category") )
82
95
  %p
83
96
  = article_form.label :tag_list , "Tags"
84
- = article_form.text_field(:tag_list, :class => "tags" , :rel => tags_string("tag") )
97
+ = article_form.text_field(:tag_list, :class => "tags" , :rel => tags_string("tag") )
85
98
  %p
86
- %em seperate categories & tags with a comma
87
-
99
+ %em seperate categories & tags with a comma
100
+
88
101
  %legend Comments
89
102
  %p
90
103
  = article_form.label :disable_comments
91
- = article_form.check_box(:disable_comments)
104
+ = article_form.check_box(:disable_comments)
92
105
  -# - unless @article.blank?
93
106
  -# %p
94
107
  -# = link_to "View Comments", admin_blog_article_comments_path(@blog, @article) , :class => "btn"
95
- - if can? :publish , Gluttonberg::Article
108
+ - if can? :publish , Gluttonberg::Article
96
109
  %legend
97
110
  Publish
98
- = f.fields_for :article , @article do |article_form|
99
- = article_form.publisable_dropdown
111
+ = f.fields_for :article , @article do |article_form|
112
+ = article_form.publisable_dropdown
100
113
  = form_controls(admin_blog_articles_path(@blog))
101
114
 
102
115
  = enable_jwysiwyg_on_class("jwysiwyg")
@@ -7,11 +7,5 @@
7
7
  .page-header
8
8
  %h1
9
9
  = @page_title.html_safe
10
- - if Gluttonberg.localized? && @article.localizations && @article.localizations.length > 1
11
- .subnav
12
- = sub_nav do
13
- - for localization in @article.localizations
14
- %li{:class => "#{ (@article_localization.locale.id == localization.locale.id ) ? 'ui-tabs-selected ui-state-active' : '' }"}
15
- %a{:href => edit_admin_blog_article_path(@blog, @article , :localization_id => localization.id) ,:id=>"edit_content_tab",:class=>"button"}
16
- = "Edit #{localization.locale.name}"
10
+
17
11
  = render :partial => "form", :locals => {:url => admin_blog_article_path(@blog, @article , :localization_id => params[:localization_id])}
@@ -49,7 +49,14 @@
49
49
  %span.caret
50
50
  %ul.dropdown-menu
51
51
  %li
52
- = link_to "Edit", edit_admin_blog_article_path(@blog, article) , :class => " "
52
+ - if Gluttonberg.localized? && article.localizations.length > 1
53
+ - for locale in Gluttonberg::Locale.all
54
+ - localization = Gluttonberg::ArticleLocalization.find(:first , :conditions => { :article_id => article.id , :locale_id => locale.id } )
55
+ %li
56
+ %a{:href => edit_admin_blog_article_path(@blog, article , :localization_id => localization.id) ,:id=>"edit_content_tab",:class=>"button"}
57
+ = "Edit #{localization.locale.name}"
58
+ - else
59
+ = link_to "Edit", edit_admin_blog_article_path(@blog, article) , :class => " "
53
60
 
54
61
 
55
62
  %li.divider
@@ -1,13 +1,22 @@
1
1
  - @page = @page_localization.page
2
2
  = form_for(@page_localization, :url => url) do |f|
3
-
3
+
4
4
  = gb_error_messages_for(@page_localization)
5
5
 
6
-
7
-
6
+
7
+
8
8
  .span5
9
9
  .tabbable
10
- .versions
10
+ .versions.page_content_form
11
+ - if Gluttonberg.localized? && Gluttonberg::Locale.all.length > 1
12
+ .btn-group
13
+ %a{ :class => "btn dropdown-toggle" , "data-toggle" => "dropdown", :href => "#"}
14
+ Editing #{@page_localization.locale.name} Content
15
+ %span.caret
16
+ %ul.dropdown-menu
17
+ - for locale in Gluttonberg::Locale.all
18
+ - localization = Gluttonberg::PageLocalization.find(:first , :conditions => { :page_id => @page.id , :locale_id => locale.id } )
19
+ %li= link_to("Edit #{locale.name} Content", edit_admin_page_page_localization_path( :page_id => @page.id, :id => localization.id), :class => "")
11
20
  - unless @page_localization.contents.blank?
12
21
  = version_listing(@page_localization.contents.first.versions , @version )
13
22
  %ul.nav.nav-tabs
@@ -22,7 +31,7 @@
22
31
  .pad
23
32
  %p
24
33
  = f.label :name
25
- = f.text_field(:name, :id => "page_title", :class => "span5")
34
+ = f.text_field(:name, :id => "page_title", :class => "span5")
26
35
  %p
27
36
  #page_slug_holder
28
37
  %span.domain
@@ -66,17 +75,16 @@
66
75
  %legend
67
76
  Page Settings
68
77
  %p
69
- = f.fields_for :page , @page do |page_form|
78
+ = f.fields_for :page , @page do |page_form|
70
79
  = render :partial => "/gluttonberg/admin/content/pages/page_settings" , :locals => {:f => page_form}
71
80
 
72
81
  %legend
73
82
  Publish
74
-
83
+
75
84
  %p
76
85
  - if @page.published?
77
86
  = submit_tag "Update", :class => "btn btn-success"
78
87
  = submit_tag "Unpublish", :class => "btn btn-danger"
79
88
  - else
80
89
  = submit_tag "Publish", :class => "btn btn-success"
81
- = submit_tag "Save as a draft", :class => "btn btn-inverse"
82
-
90
+ = submit_tag "Save as a draft", :class => "btn btn-inverse"
@@ -1,7 +1,7 @@
1
1
  - @window_title = "Content"
2
2
  - select_page_title = @page.name.blank? ? "Edit Content" : "#{@page.name}"
3
3
  - if(Gluttonberg.localized? && @page.localizations && @page.localizations.length > 1)
4
- - select_page_title = "Edit #{@page_localization.locale.slug} Content"
4
+ - select_page_title = "Edit #{@page_localization.locale.name} Content"
5
5
  - @page_title = "#{link_to "Pages", admin_pages_path} > #{select_page_title}"
6
6
 
7
7
  .row-fluid#edit-form
@@ -6,14 +6,14 @@
6
6
  = link_to("#{page.home ? "#{default_localization.name} (Home page)" : default_localization.name}", edit_admin_page_page_localization_path( :page_id => page.id, :id => default_localization.id))
7
7
  %td.author{:style => "width:15%"}
8
8
  = page.user.full_name
9
-
9
+
10
10
  %td.published_state{:class=>"#{page.publishing_status.downcase}", :style => "width:15%"}
11
11
  = page.publishing_status
12
12
  - unless page.published_at.blank?
13
13
  %br
14
14
  %span.date
15
15
  = page.published_at.strftime("%d/%m/%Y")
16
-
16
+
17
17
  %td{:style => 'width:35%'}
18
18
  .btn-group
19
19
  %a{ :class => "btn dropdown-toggle" , "data-toggle" => "dropdown" , :href => "#"}
@@ -21,13 +21,15 @@
21
21
  %span.caret
22
22
  %ul.dropdown-menu
23
23
  - if Gluttonberg.localized? && page.localizations.length > 1
24
+ - for locale in Gluttonberg::Locale.all
25
+ - localization = Gluttonberg::PageLocalization.find(:first , :conditions => { :page_id => page.id , :locale_id => locale.id } )
26
+ %li= link_to("Edit #{locale.name} Content", edit_admin_page_page_localization_path( :page_id => page.id, :id => localization.id), :class => "")
27
+ - else
24
28
  %li= link_to("Edit", edit_admin_page_page_localization_path( :page_id => page.id, :id => default_localization.id), :class => "")
25
- - else
26
- %li= link_to("Edit", edit_admin_page_page_localization_path( :page_id => page.id, :id => default_localization.id), :class => "")
27
- %li= link_to("Preview", default_localization.public_path, :class => "", :target => "_blank")
29
+ %li= link_to("Preview", default_localization.public_path, :class => "", :target => "_blank")
28
30
 
29
- %li.divider
30
- %li= link_to("Duplicate", duplicate_admin_page_path( :id => page.id), :class => "")
31
+ %li.divider
32
+ %li= link_to("Duplicate", duplicate_admin_page_path( :id => page.id), :class => "")
31
33
 
32
34
  - if can? :destroy , Gluttonberg::Page
33
35
  %li.divider
@@ -49,11 +49,11 @@
49
49
  .navbar-main
50
50
  %ul.nav
51
51
  %li
52
- = active_link_to("Dashboard", admin_root_path, :id => "dashboard_nav" , :title => "Dashboard", :active => params[:controller].include?('Gluttonberg/admin/main'))
52
+ = active_link_to("Dashboard", admin_root_path, :id => "dashboard_nav" , :title => "Dashboard", :active => params[:controller].include?('gluttonberg/admin/main'))
53
53
  %li
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) )))
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
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/AssetLibrary') )
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
57
 
58
58
  - for entry in Gluttonberg::Components.main_nav_entries
59
59
  -if entry[2].blank? || entry[2]==false || (entry[2]==true && session.user.is_super_admin)
@@ -63,7 +63,7 @@
63
63
  %li
64
64
  = active_link_to("Members", admin_membership_members_path, :id => "membership_nav" , :title => "Members" , :active => /^\/admin\/membership/)
65
65
  %li
66
- = active_link_to("Settings", admin_generic_settings_path, :id => "settings_nav" , :title => "Settings" , :active => params[:controller].include?('Gluttonberg/admin/Settings/') )
66
+ = active_link_to("Settings", admin_generic_settings_path, :id => "settings_nav" , :title => "Settings" , :active => params[:controller].include?('gluttonberg/admin/settings/') )
67
67
 
68
68
 
69
69
  .container-fluid
@@ -0,0 +1,6 @@
1
+ class AddArtistAndLinkToAssets < ActiveRecord::Migration
2
+ def change
3
+ add_column :gb_assets , :artist_name , :string
4
+ add_column :gb_assets , :link , :string
5
+ end
6
+ end
data/lib/engine.rb CHANGED
@@ -8,7 +8,7 @@ module Gluttonberg
8
8
  config.widget_factory_name = "default factory name"
9
9
  config.mount_at = '/'
10
10
  config.admin_path = '/admin'
11
- config.app_name = 'Gluttonberg 2.1'
11
+ config.app_name = 'Gluttonberg 2.5'
12
12
  config.localize = false
13
13
  config.flagged_content = false
14
14
  config.active_record.observers = ['gluttonberg/page_observer' , 'gluttonberg/page_localization_observer' , 'gluttonberg/locale_observer' ]
@@ -27,6 +27,8 @@ module Gluttonberg
27
27
  #use this to provide additional processor for assets
28
28
  #in first stage I am going to use it with Tv
29
29
  config.asset_processors = []
30
+ config.asset_mixins = []
31
+ config.member_mixins = []
30
32
  config.search_models = {
31
33
  "Gluttonberg::Page" => [:name],
32
34
  "Gluttonberg::Blog" => [:name , :description],
@@ -1,6 +1,6 @@
1
1
  module Gluttonberg
2
2
  # This module allows custom controllers to be registered wtih Gluttonberg’s
3
- # administration. Typically, these controllers will be registered in the
3
+ # administration. Typically, these controllers will be registered in the
4
4
  # application’s before_app_loads block.
5
5
  module Components
6
6
  @@components = {}
@@ -9,8 +9,8 @@ module Gluttonberg
9
9
  @@main_nav_entries = []
10
10
  @@registered = nil
11
11
  Component = Struct.new(:name, :label , :admin_url, :only_for_super_admin )
12
-
13
- # Registers a controller — or set of controllers — based on the URLs
12
+
13
+ # Registers a controller — or set of controllers — based on the URLs
14
14
  # specified in the routes.
15
15
  #
16
16
  # Components.register(:forum, :label => "Forum", :admin_url => url) do |scope|
@@ -21,42 +21,43 @@ module Gluttonberg
21
21
  @@components[name] = opts
22
22
  @@routes[name] = routes if block_given?
23
23
  end
24
-
25
-
24
+
25
+
26
26
  # Returns a hash of the registered components, keyed to their label.
27
27
  def self.registered
28
28
  @@registered ||= @@components.collect {|k, v| Component.new(k.to_s, v[:label] , v[:only_for_super_admin])}
29
29
  end
30
-
30
+
31
31
  # Returns an array of components that have been given a nav_label —
32
32
  # the label implicitly registers them as nav entries. Components without
33
33
  # a label won’t turn up.
34
- def self.nav_entries
35
- @@nav_entries ||= @@components.collect do |k, v|
36
-
34
+ def self.nav_entries(section_name="")
35
+ temp = @@components.find_all{|k,v| (section_name.blank? && (!v.has_key?(:section_name) || v[:section_name].blank?)) || (!section_name.blank? && v[:section_name] == section_name) }
36
+ nav_entries = temp.collect do |k, v|
37
+
37
38
  url = if v[:admin_url]
38
39
  if v[:admin_url].is_a? Symbol
39
40
  v[:admin_url]
40
41
  else
41
42
  v[:admin_url]
42
43
  end
43
- end
44
+ end
44
45
  [v[:label], k, url , v[:only_for_super_admin]]
45
46
  end
46
47
  end
47
-
48
-
48
+
49
+
49
50
  def self.register_for_main_nav(name , url , only_for_super_admin = false )
50
51
  @@main_nav_entries << [name , url , only_for_super_admin]
51
- end
52
-
52
+ end
53
+
53
54
  # Returns an array of components that have been given a nav_label —
54
55
  # the label implicitly registers them as nav entries. Components without
55
56
  # a label won’t turn up.
56
- def self.main_nav_entries
57
- @@main_nav_entries
57
+ def self.main_nav_entries
58
+ @@main_nav_entries
58
59
  end
59
60
 
60
-
61
+
61
62
  end
62
63
  end