humpyard 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +28 -0
- data/README.rdoc +61 -0
- data/VERSION +1 -0
- data/app/controllers/humpyard/assets_controller.rb +123 -0
- data/app/controllers/humpyard/elements_controller.rb +200 -0
- data/app/controllers/humpyard/errors_controller.rb +8 -0
- data/app/controllers/humpyard/pages_controller.rb +365 -0
- data/app/helpers/humpyard/pages_helper.rb +19 -0
- data/app/models/humpyard/asset.rb +22 -0
- data/app/models/humpyard/assets/paperclip_asset.rb +48 -0
- data/app/models/humpyard/assets/youtube_asset.rb +38 -0
- data/app/models/humpyard/element.rb +57 -0
- data/app/models/humpyard/elements/box_element.rb +15 -0
- data/app/models/humpyard/elements/media_element.rb +13 -0
- data/app/models/humpyard/elements/news_element.rb +13 -0
- data/app/models/humpyard/elements/sitemap_element.rb +11 -0
- data/app/models/humpyard/elements/text_element.rb +49 -0
- data/app/models/humpyard/news_item.rb +42 -0
- data/app/models/humpyard/page.rb +153 -0
- data/app/models/humpyard/pages/news_page.rb +71 -0
- data/app/models/humpyard/pages/static_page.rb +25 -0
- data/app/models/humpyard/pages/virtual_page.rb +30 -0
- data/app/views/humpyard/assets/_edit.html.haml +15 -0
- data/app/views/humpyard/assets/_index.html.haml +24 -0
- data/app/views/humpyard/assets/_list.html.haml +4 -0
- data/app/views/humpyard/assets/_list_item.html.haml +1 -0
- data/app/views/humpyard/assets/_show.html.haml +38 -0
- data/app/views/humpyard/assets/_show_asset.html.haml +3 -0
- data/app/views/humpyard/assets/destroy.js.erb +4 -0
- data/app/views/humpyard/assets/paperclip_assets/_edit.html.haml +4 -0
- data/app/views/humpyard/assets/paperclip_assets/_info_table.html.haml +10 -0
- data/app/views/humpyard/assets/paperclip_assets/_show.html.haml +12 -0
- data/app/views/humpyard/assets/youtube_assets/_edit.html.haml +4 -0
- data/app/views/humpyard/assets/youtube_assets/_show.html.haml +5 -0
- data/app/views/humpyard/common/_head.html.haml +8 -0
- data/app/views/humpyard/common/_page_construct.html.haml +45 -0
- data/app/views/humpyard/elements/_edit.html.haml +25 -0
- data/app/views/humpyard/elements/_inline_edit.haml +0 -0
- data/app/views/humpyard/elements/_new.html.haml +1 -0
- data/app/views/humpyard/elements/_show.html.haml +29 -0
- data/app/views/humpyard/elements/_show_container.html.haml +3 -0
- data/app/views/humpyard/elements/_show_view.html.haml +2 -0
- data/app/views/humpyard/elements/box_elements/_edit.html.haml +4 -0
- data/app/views/humpyard/elements/box_elements/_inline_edit.html.haml +0 -0
- data/app/views/humpyard/elements/box_elements/_show.html.haml +5 -0
- data/app/views/humpyard/elements/destroy.js.erb +1 -0
- data/app/views/humpyard/elements/error.js.erb +1 -0
- data/app/views/humpyard/elements/media_elements/_edit.html.haml +7 -0
- data/app/views/humpyard/elements/media_elements/_show.html.haml +8 -0
- data/app/views/humpyard/elements/news_elements/_edit.html.haml +5 -0
- data/app/views/humpyard/elements/news_elements/_inline_edit.html.haml +0 -0
- data/app/views/humpyard/elements/news_elements/_show.html.haml +4 -0
- data/app/views/humpyard/elements/sitemap_elements/_edit.html.haml +5 -0
- data/app/views/humpyard/elements/sitemap_elements/_inline_edit.html.haml +0 -0
- data/app/views/humpyard/elements/sitemap_elements/_show.html.haml +3 -0
- data/app/views/humpyard/elements/sitemap_elements/_show_part.html.haml +12 -0
- data/app/views/humpyard/elements/text_elements/_edit.html.haml +4 -0
- data/app/views/humpyard/elements/text_elements/_inline_edit.html.haml +0 -0
- data/app/views/humpyard/elements/text_elements/_show.html.haml +4 -0
- data/app/views/humpyard/pages/_content.html.haml +2 -0
- data/app/views/humpyard/pages/_edit.html.haml +39 -0
- data/app/views/humpyard/pages/_index.html.haml +23 -0
- data/app/views/humpyard/pages/_show.html.haml +16 -0
- data/app/views/humpyard/pages/_subtree.html.haml +6 -0
- data/app/views/humpyard/pages/_tree.html.haml +3 -0
- data/app/views/humpyard/pages/destroy.js.erb +4 -0
- data/app/views/humpyard/pages/news_pages/_detail.html.haml +10 -0
- data/app/views/humpyard/pages/news_pages/_edit.html.haml +3 -0
- data/app/views/humpyard/pages/news_pages/_show.html.haml +5 -0
- data/app/views/humpyard/pages/show.html.haml +3 -0
- data/app/views/humpyard/pages/static_pages/_edit.html.haml +1 -0
- data/app/views/humpyard/pages/static_pages/_show.html.haml +1 -0
- data/app/views/humpyard/pages/virtual_pages/_edit.html.haml +7 -0
- data/app/views/humpyard/pages/virtual_pages/_show.html.haml +4 -0
- data/app/views/humpyard/pages/welcome.html.haml +13 -0
- data/compass/stylesheets/_humpyard.scss +12 -0
- data/compass/stylesheets/humpyard/_backend.scss +1 -0
- data/compass/stylesheets/humpyard/_base.scss +144 -0
- data/compass/stylesheets/humpyard/_ie.scss +1 -0
- data/compass/stylesheets/humpyard/_jquery_ui_overrides.scss +380 -0
- data/compass/stylesheets/humpyard/_print.scss +3 -0
- data/config/locales/de.yml +84 -0
- data/config/locales/en.yml +81 -0
- data/config/routes.rb +38 -0
- data/db/migrate/20100321134138_base.rb +60 -0
- data/db/migrate/20100330204700_create_box_element.rb +24 -0
- data/db/migrate/20100401153655_page_template.rb +11 -0
- data/db/migrate/20100409195732_page_types.rb +26 -0
- data/db/migrate/20100413230623_element_yield.rb +14 -0
- data/db/migrate/20100415132312_news_page.rb +48 -0
- data/db/migrate/20100415193423_page_i18n_name.rb +27 -0
- data/db/migrate/20100415213700_create_news_element.rb +12 -0
- data/db/migrate/20100703120000_shared_elements.rb +9 -0
- data/db/migrate/20101001142534_page_modified_at.rb +11 -0
- data/db/migrate/20101003100138_create_sitemap_elements.rb +13 -0
- data/db/migrate/20101003122108_create_humpyard_pages_virtual_pages.rb +11 -0
- data/db/migrate/20101006070503_page_cache_control.rb +9 -0
- data/db/migrate/20101104173743_create_media.rb +36 -0
- data/db/migrate/20110425230524_media_with_link.rb +9 -0
- data/lib/generators/humpyard.rb +114 -0
- data/lib/generators/humpyard/auth/auth_generator.rb +191 -0
- data/lib/generators/humpyard/auth/templates/authlogic/README +9 -0
- data/lib/generators/humpyard/auth/templates/authlogic/controllers/user_sessions_controller.rb +22 -0
- data/lib/generators/humpyard/auth/templates/authlogic/migration.rb +17 -0
- data/lib/generators/humpyard/auth/templates/authlogic/models/ability.rb +12 -0
- data/lib/generators/humpyard/auth/templates/authlogic/models/user.rb +7 -0
- data/lib/generators/humpyard/auth/templates/authlogic/models/user_session.rb +6 -0
- data/lib/generators/humpyard/auth/templates/authlogic/views/user_sessions/new.html.haml +12 -0
- data/lib/generators/humpyard/auth/templates/custom/README +8 -0
- data/lib/generators/humpyard/auth/templates/devise/README +14 -0
- data/lib/generators/humpyard/auth/templates/devise/models/ability.rb +14 -0
- data/lib/generators/humpyard/auth/templates/fake/README +0 -0
- data/lib/generators/humpyard/auth/templates/fake/models/ability.rb +12 -0
- data/lib/generators/humpyard/auth/templates/simple/README +16 -0
- data/lib/generators/humpyard/auth/templates/simple/config/humpyard_users.yml +2 -0
- data/lib/generators/humpyard/auth/templates/simple/controllers/user_sessions_controller.rb +39 -0
- data/lib/generators/humpyard/auth/templates/simple/models/ability.rb +12 -0
- data/lib/generators/humpyard/auth/templates/simple/views/user_sessions/new.html.haml +15 -0
- data/lib/generators/humpyard/element/USAGE +7 -0
- data/lib/generators/humpyard/element/element_generator.rb +82 -0
- data/lib/generators/humpyard/element/templates/_edit.html.haml +12 -0
- data/lib/generators/humpyard/element/templates/_inline_edit.html.haml +0 -0
- data/lib/generators/humpyard/element/templates/_show.html.haml +9 -0
- data/lib/generators/humpyard/element/templates/fixtures.yml +23 -0
- data/lib/generators/humpyard/element/templates/migration.rb +16 -0
- data/lib/generators/humpyard/element/templates/model.rb +11 -0
- data/lib/generators/humpyard/element/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/humpyard/element/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/humpyard/element/templates/tests/test_unit/model.rb +7 -0
- data/lib/generators/humpyard/page/USAGE +7 -0
- data/lib/generators/humpyard/page/page_generator.rb +80 -0
- data/lib/generators/humpyard/page/templates/_edit.html.haml +7 -0
- data/lib/generators/humpyard/page/templates/_show.html.haml +4 -0
- data/lib/generators/humpyard/page/templates/fixtures.yml +23 -0
- data/lib/generators/humpyard/page/templates/migration.rb +16 -0
- data/lib/generators/humpyard/page/templates/model.rb +37 -0
- data/lib/generators/humpyard/page/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/humpyard/page/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/humpyard/page/templates/tests/test_unit/model.rb +7 -0
- data/lib/generators/humpyard/skeleton/USAGE +6 -0
- data/lib/generators/humpyard/skeleton/skeleton_generator.rb +99 -0
- data/lib/generators/humpyard/skeleton/templates/compass.config +14 -0
- data/lib/generators/humpyard/skeleton/templates/images/ajax-loader.gif +0 -0
- data/lib/generators/humpyard/skeleton/templates/images/grid.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/initializers/compass.rb +16 -0
- data/lib/generators/humpyard/skeleton/templates/initializers/haml.rb +3 -0
- data/lib/generators/humpyard/skeleton/templates/initializers/humpyard.rb +20 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/images/jstree/d.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/images/jstree/throbber.gif +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/javascripts/jquery-1.5.1.js +8316 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/javascripts/jquery-humpyard.js +790 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/javascripts/jquery-rails.js +157 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/javascripts/jquery-ui-1.8.10.js +11544 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/javascripts/jquery.form-2.64.js +803 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/javascripts/jquery.jstree.js +3510 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/generators/humpyard/skeleton/templates/javascripts/jquery-ui-18/stylesheets/smoothness/jquery-ui-1.8.10.css +573 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/ie.sass +15 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/ie.scss +16 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/partials/_base.sass +12 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/partials/_base.scss +11 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/print.sass +3 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/print.scss +3 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/screen.sass +78 -0
- data/lib/generators/humpyard/skeleton/templates/stylesheets/screen.scss +90 -0
- data/lib/generators/humpyard/skeleton/templates/views/layout.html.haml +28 -0
- data/lib/html_to_textile.rb +220 -0
- data/lib/humpyard.rb +70 -0
- data/lib/humpyard/action_controller/base.rb +24 -0
- data/lib/humpyard/active_model/naming.rb +29 -0
- data/lib/humpyard/active_model/translation.rb +26 -0
- data/lib/humpyard/active_model/validators/publish_range.rb +14 -0
- data/lib/humpyard/active_record/acts/asset.rb +68 -0
- data/lib/humpyard/active_record/acts/container_element.rb +26 -0
- data/lib/humpyard/active_record/acts/element.rb +89 -0
- data/lib/humpyard/active_record/acts/page.rb +101 -0
- data/lib/humpyard/active_record/has/title_for_url.rb +75 -0
- data/lib/humpyard/compass.rb +6 -0
- data/lib/humpyard/config.rb +235 -0
- data/lib/humpyard/engine.rb +7 -0
- data/lib/humpyard/uri_parser.rb +16 -0
- data/lib/humpyard/uri_parser/assets_uri_parser.rb +15 -0
- data/lib/humpyard/uri_parser/pages_uri_parser.rb +15 -0
- data/lib/tasks/humpyard.rake +103 -0
- metadata +331 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
module Humpyard
|
2
|
+
module Pages
|
3
|
+
####
|
4
|
+
# Humpyard::Pages::NewsPage is a page containing news articles
|
5
|
+
class NewsPage < ::ActiveRecord::Base
|
6
|
+
acts_as_humpyard_page :system_page => true
|
7
|
+
|
8
|
+
has_many :news_items, :class_name => 'Humpyard::NewsItem', :foreign_key => :news_page_id, :order => "#{Humpyard::NewsItem.table_name}.created_at DESC"
|
9
|
+
has_many :news_elements, :class_name => 'Humpyard::Elements::NewsElement', :foreign_key => :news_page_id
|
10
|
+
|
11
|
+
def is_humpyard_dynamic_page?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
def parse_path(path)
|
16
|
+
return nil if path.size != 4
|
17
|
+
begin
|
18
|
+
item_created_on = Time.local(path[0], path[1], path[2]).to_date
|
19
|
+
rescue
|
20
|
+
# Rescue if no valid date was given in first 3 path parts
|
21
|
+
return nil
|
22
|
+
end
|
23
|
+
|
24
|
+
item = news_items.find_by_title_for_url(path[3])
|
25
|
+
return nil if item.nil?
|
26
|
+
|
27
|
+
return nil if item.created_at.to_date != item_created_on
|
28
|
+
|
29
|
+
return {
|
30
|
+
:partial => 'detail',
|
31
|
+
:locals => {:item => item}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def child_pages
|
36
|
+
[]
|
37
|
+
end
|
38
|
+
|
39
|
+
def parent_page
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
def site_map(locale)
|
44
|
+
if page.in_sitemap
|
45
|
+
{
|
46
|
+
:url => page.human_url(:locale => locale),
|
47
|
+
:lastmod => page.last_modified,
|
48
|
+
:hidden => !page.in_sitemap,
|
49
|
+
:children => news_items.map do |i|
|
50
|
+
{
|
51
|
+
:url => i.human_url(:locale => locale),
|
52
|
+
:lastmod => i.updated_at,
|
53
|
+
:hidden => !page.in_sitemap,
|
54
|
+
:children => []
|
55
|
+
}
|
56
|
+
end
|
57
|
+
}
|
58
|
+
else
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Return the logical modification time for the page, suitable for http caching, generational cache keys, etc.
|
64
|
+
def last_modified_with_news_items
|
65
|
+
timestamps = [last_modified_without_news_items] + news_items.collect{|i| i.updated_at}
|
66
|
+
timestamps.sort.last
|
67
|
+
end
|
68
|
+
alias_method_chain :last_modified, :news_items
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Humpyard
|
2
|
+
module Pages
|
3
|
+
####
|
4
|
+
# Humpyard::Pages::StaticPage is a page only containing elements.
|
5
|
+
class StaticPage < ::ActiveRecord::Base
|
6
|
+
acts_as_humpyard_page :system_page => true
|
7
|
+
|
8
|
+
def is_humpyard_dynamic_page?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
def site_map(locale)
|
13
|
+
if page.in_sitemap
|
14
|
+
{
|
15
|
+
:url => page.human_url(:locale => locale),
|
16
|
+
:lastmod => page.last_modified,
|
17
|
+
:children => page.child_pages.map{ |p| p.content_data.site_map(locale) }
|
18
|
+
}
|
19
|
+
else
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Humpyard
|
2
|
+
module Pages
|
3
|
+
class VirtualPage < ::ActiveRecord::Base
|
4
|
+
acts_as_humpyard_page
|
5
|
+
|
6
|
+
set_table_name "#{Humpyard::config.table_name_prefix}pages_virtual_pages"
|
7
|
+
|
8
|
+
def is_humpyard_dynamic_page?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
def is_humpyard_virtual_page?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
def site_map(locale)
|
17
|
+
if page.in_sitemap
|
18
|
+
{
|
19
|
+
:url => page.human_url(:locale => locale),
|
20
|
+
:lastmod => page.last_modified,
|
21
|
+
:hidden => true,
|
22
|
+
:children => page.child_pages.map{ |p| p.content_data.site_map(locale) }
|
23
|
+
}
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= humpyard_form_for @asset, :as => :asset, :url => url_for(:controller=>:'humpyard/assets', :action=>@asset.persisted? ? :update : :create), :html=>{:'data-dialog-remote' => true, :'data-dialog-form'=>'true', :'data-form-object-class' => "asset", :class=>'asset-form'} do |form|
|
2
|
+
- unless @asset.persisted?
|
3
|
+
= hidden_field_tag :type, @asset_type
|
4
|
+
.dialog-search
|
5
|
+
= "#{I18n.t("humpyard_form.titles.#{form.form_type.downcase}", :model => "#{Humpyard::Asset.model_name.human}#{@asset.title.blank? ? '' : " '#{@asset.title}'"}")}"
|
6
|
+
.dialog-pane
|
7
|
+
.flashes
|
8
|
+
.humpyard-tabview
|
9
|
+
- custom_partial_path = "/humpyard/assets/#{@asset.class.name.underscore.pluralize.gsub(/^humpyard\/assets/, '')}/edit"
|
10
|
+
- if template_exists? custom_partial_path , nil, true
|
11
|
+
= render :partial => custom_partial_path, :locals => {:asset => @asset, :form => form}
|
12
|
+
.dialog-buttons.humpyard-form-buttons
|
13
|
+
= form.submit
|
14
|
+
- if @asset.persisted? and can? :destroy, @asset.asset
|
15
|
+
= link_to "#{I18n.t("humpyard_form.actions.destroy", :model => "#{Humpyard::Asset.model_name.human}#{@asset.title.blank? ? '' : " '#{@asset.title}'"}")}", humpyard_asset_path(@asset), :'data-icon' => "ui-icon-trash", :confirm => "Are you sure?", :method => :delete, :remote => true
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.humpyard-dialog-title
|
2
|
+
= I18n.t 'humpyard_form.titles.index', :model => Humpyard::Asset.model_name.human
|
3
|
+
.dialog-columns
|
4
|
+
.left-dialog-column.with-toolbar
|
5
|
+
.dialog-list
|
6
|
+
#hy-asset-listview
|
7
|
+
= render 'list', :assets => @assets, :asset => @asset
|
8
|
+
#humpyard-asset-types-menu.dialog-menu
|
9
|
+
- if can? :new, Humpyard::Asset
|
10
|
+
- Humpyard::config.asset_types.each do |name, type|
|
11
|
+
= link_to I18n.t('humpyard_form.actions.new', :model => type.model_name.human), new_humpyard_asset_path(:type => name), :'data-dialog-link' => true
|
12
|
+
.dialog-buttons.humpyard-form-buttons
|
13
|
+
%a{:'data-icon' => "ui-icon-circle-plus", :'data-dialog-menu' => '#humpyard-asset-types-menu'}
|
14
|
+
= I18n.t('humpyard_cms.pages.edit.add', :page_type => Humpyard::Page.model_name.human)
|
15
|
+
.right-dialog-column.with-toolbar.with-search
|
16
|
+
|
17
|
+
.dialog-buttons.humpyard-form-buttons
|
18
|
+
|
19
|
+
- if @asset
|
20
|
+
= render :partial => 'show', :locals => {:page => @page}
|
21
|
+
- else
|
22
|
+
.dialog-pane
|
23
|
+
Nothing selected
|
24
|
+
.humpyard-dialog-buttons
|
@@ -0,0 +1 @@
|
|
1
|
+
= link_to content_tag(:span, asset.content_data.title), asset, :'data-dialog-link' => true, :class => (active ? 'active' : ''), :id => "hy-asset-listview-link-#{asset.id}"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
.dialog-search
|
2
|
+
= "#{I18n.t("humpyard_form.titles.show", :model => "#{Humpyard::Asset.model_name.human}#{@asset.title.blank? ? '' : " '#{@asset.title}'"}")}"
|
3
|
+
.dialog-pane
|
4
|
+
%table.data_table
|
5
|
+
%tr
|
6
|
+
%td
|
7
|
+
= Humpyard::Asset.human_attribute_name :content_type
|
8
|
+
%td
|
9
|
+
= @asset.content_type
|
10
|
+
- unless @asset.width.blank?
|
11
|
+
%tr
|
12
|
+
%td
|
13
|
+
= Humpyard::Asset.human_attribute_name :width
|
14
|
+
%td
|
15
|
+
= @asset.width
|
16
|
+
- unless @asset.height.blank?
|
17
|
+
%tr
|
18
|
+
%td
|
19
|
+
= Humpyard::Asset.human_attribute_name :height
|
20
|
+
%td
|
21
|
+
= @asset.height
|
22
|
+
%tr
|
23
|
+
%td
|
24
|
+
= Humpyard::Asset.human_attribute_name :url
|
25
|
+
%td
|
26
|
+
= number_to_human_size @asset.url
|
27
|
+
- custom_partial_path = "/humpyard/assets/#{@asset.class.name.underscore.pluralize.gsub(/^humpyard\/assets/, '')}/info_asset"
|
28
|
+
- if template_exists? custom_partial_path , nil, true
|
29
|
+
= render :partial => custom_partial_path, :locals => {:asset => @asset}
|
30
|
+
= render :partial => "/humpyard/assets/show_asset", :locals => {:asset => @asset, :element => nil}
|
31
|
+
|
32
|
+
|
33
|
+
.dialog-buttons.humpyard-form-buttons
|
34
|
+
- if can? :destroy, @asset.asset
|
35
|
+
= link_to "#{I18n.t("humpyard_form.actions.destroy", :model => "#{Humpyard::Asset.model_name.human}#{@asset.title.blank? ? '' : " '#{@asset.title}'"}")}", humpyard_asset_path(@asset), :'data-icon' => "ui-icon-trash", :confirm => "Are you sure?", :method => :delete, :remote => true
|
36
|
+
- if can? :update, @asset.asset
|
37
|
+
= link_to "#{I18n.t("humpyard_form.actions.edit", :model => "#{Humpyard::Asset.model_name.human}#{@asset.title.blank? ? '' : " '#{@asset.title}'"}")}", edit_humpyard_asset_path(@asset), :'data-icon' => "ui-icon-pencil", :'data-dialog-link' => true
|
38
|
+
|
@@ -0,0 +1,4 @@
|
|
1
|
+
remove_element('#hy-asset-listview-text-<%=@asset.id%>');
|
2
|
+
replace_content_for_element('#assets-dialog .right-dialog-column .dialog-pane', '<p><%= escape_javascript "#{I18n.t("humpyard_form.flashes.destroy_success", :model => "#{Humpyard::Asset.model_name.human}#{@asset.title.blank? ? '' : " '#{@asset.title}'"}")}" %></p>');
|
3
|
+
remove_element('#assets-dialog .right-dialog-column .dialog-buttons a');
|
4
|
+
remove_element('#assets-dialog .right-dialog-column .dialog-buttons button');
|
@@ -0,0 +1,12 @@
|
|
1
|
+
- if asset.content_type.match /image\//
|
2
|
+
- if element and element.content_data and not element.content_data.uri.blank?
|
3
|
+
= link_to element.content_data.uri do
|
4
|
+
= image_tag "#{asset.url}", :width => asset.width, :height => asset.height
|
5
|
+
- else
|
6
|
+
= image_tag "#{asset.url}", :width => asset.width, :height => asset.height
|
7
|
+
- elsif asset.media_content_type.match /audio\//
|
8
|
+
%div{:align => "center"}
|
9
|
+
%object{:type => "audio/mpeg", :data => "#{asset.url}", :width => 200, :height => 20}
|
10
|
+
%param{:name => "src", :value => "#{asset.url}"}
|
11
|
+
%param{:name => "autoplay", :value => "true"}
|
12
|
+
%param{:name => "autoStart", :value => "1"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%object{:width => 560, :height => 340}
|
2
|
+
%param{:name => "movie", :value => "http://www.youtube.com/v/#{asset.youtube_video_id}"}
|
3
|
+
%param{:name => "allowFullScreen", :value => "true"}
|
4
|
+
%param{:name =>"allowscriptaccess", :value => "always"}
|
5
|
+
%embed{:src => "http://www.youtube.com/v/#{asset.youtube_video_id}", :type =>"application/x-shockwave-flash", :allowscriptaccess => "always", :allowfullscreen => "true", :width => 560, :height => 340}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
%title
|
2
|
+
= "#{Humpyard::config.browser_title_prefix}#{@content_for_title || 'Untitled'}#{Humpyard::config.browser_title_postfix}"
|
3
|
+
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
4
|
+
= stylesheet_link_tag "#{Humpyard::config.compass_stylesheet_link_tag_path}screen.css", :media => 'screen, projection'
|
5
|
+
= stylesheet_link_tag "#{Humpyard::config.compass_stylesheet_link_tag_path}print.css", :media => 'print'
|
6
|
+
/[if lt IE 8]
|
7
|
+
= stylesheet_link_tag "#{Humpyard::config.compass_stylesheet_link_tag_path}ie.css", :media => 'screen, projection'
|
8
|
+
= @content_for_head
|
@@ -0,0 +1,45 @@
|
|
1
|
+
- if humpyard_user
|
2
|
+
%body.hy-logged-in
|
3
|
+
#hy-top.hy-eb
|
4
|
+
|
5
|
+
#hy-top-left
|
6
|
+
= image_tag "ajax-loader.gif", :size => "16x16", :class => "ajax-indicator"
|
7
|
+
= link_to I18n.t('humpyard_cms.toolbar.edit'), '#', :'data-command' => "toggleEditMode", :'data-icon' => "ui-icon-pencil" if @page and can? :update, @page
|
8
|
+
- Humpyard::config.toolbar_actions.each do |key,action|
|
9
|
+
- if action[:class].nil? or can? :manage, action[:class]
|
10
|
+
- options = {}
|
11
|
+
- url = '#'
|
12
|
+
- title = ''
|
13
|
+
|
14
|
+
- unless action[:icon].blank?
|
15
|
+
- options[:'data-icon'] = action[:icon]
|
16
|
+
- unless action[:action].blank?
|
17
|
+
- url = url_for(:controller => action[:controller], :action => action[:action], :actual_page_id => @page ? @page.id : nil)
|
18
|
+
- unless action[:command].blank?
|
19
|
+
- options[:'data-command'] = action[:command]
|
20
|
+
- unless action[:dialog].blank?
|
21
|
+
- options[:'data-dialog'] = action[:dialog]
|
22
|
+
- unless action[:title].blank?
|
23
|
+
- title = action[:title]
|
24
|
+
|
25
|
+
= link_to I18n.t(title), url, options
|
26
|
+
|
27
|
+
= @content_for_toolbar
|
28
|
+
|
29
|
+
#hy-top-right
|
30
|
+
= link_to I18n.t('humpyard_cms.toolbar.logout'), humpyard_logout_path
|
31
|
+
|
32
|
+
#hy-bottom.hy-eb
|
33
|
+
- Humpyard::config.element_types.each do |name, type|
|
34
|
+
- if not type.nil?
|
35
|
+
.element{'data-addable'=>'hy-elements', 'data-draggable'=>'hy-elements', 'data-element-type'=>name, 'data-create-url'=>new_humpyard_element_path, :class => "hy-content-element-icon-#{type.to_s.underscore.dasherize}"}
|
36
|
+
%span
|
37
|
+
= type.model_name.human
|
38
|
+
|
39
|
+
#hy-body.hy-eb{'data-page-id' => @page ? @page.id : false}
|
40
|
+
= capture_haml(&block)
|
41
|
+
|
42
|
+
- else
|
43
|
+
%body
|
44
|
+
#hy-body
|
45
|
+
= capture_haml(&block)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
= humpyard_form_for @element, :as => :element, :url => url_for(:controller=>:'humpyard/elements', :action=>@element.persisted? ? :update : :create), :html=>{:'data-dialog-remote' => true, :'data-dialog-form'=>'true', :'data-form-object-class' => "element", :class=>'element-form'} do |form|
|
2
|
+
.humpyard-dialog-title
|
3
|
+
= @element.class.model_name.human
|
4
|
+
- unless @element.persisted?
|
5
|
+
= hidden_field :element, :page_id
|
6
|
+
= hidden_field :element, :container_id
|
7
|
+
= hidden_field :element, :page_yield_name
|
8
|
+
= hidden_field_tag :type, @element_type
|
9
|
+
- if @prev
|
10
|
+
= hidden_field_tag :prev_id, @prev.id
|
11
|
+
- if @next
|
12
|
+
= hidden_field_tag :next_id, @next.id
|
13
|
+
.humpyard-tabview
|
14
|
+
- custom_partial_path = "/humpyard/elements/#{@element.class.name.underscore.pluralize.gsub(/^humpyard\/elements/, '')}/edit"
|
15
|
+
- if template_exists? custom_partial_path , nil, true
|
16
|
+
= render :partial => custom_partial_path, :locals => {:element => @element, :form => form}
|
17
|
+
.humpyard-tab
|
18
|
+
.humpyard-tab-title
|
19
|
+
Generic Options
|
20
|
+
= form.input :shared_state, :as => :select, :collection => Humpyard::Element::SHARED_STATES.map{|key,value| [I18n.t("humpyard_cms.shared_state_info.owning_page.#{value}"), value]}
|
21
|
+
= form.input :display_from
|
22
|
+
= form.input :display_until
|
23
|
+
.humpyard-dialog-buttons
|
24
|
+
= form.submit
|
25
|
+
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
New
|
@@ -0,0 +1,29 @@
|
|
1
|
+
- if can? :manage, Humpyard::Element
|
2
|
+
.hy-el{:id => "hy-id-#{element.id}", :'data-draggable'=>"hy-elements", :'data-element-id'=>element.id}
|
3
|
+
= render :partial => "/humpyard/elements/show_view", :locals => {:element => element}
|
4
|
+
.hy-marker-frame.top
|
5
|
+
.hy-marker-frame.bottom
|
6
|
+
.hy-marker-frame.left
|
7
|
+
.hy-marker-frame.right
|
8
|
+
.hy-el-menu
|
9
|
+
=link_to 'Edit', edit_humpyard_element_path(element), :'data-dialog' => 'size:600;modal:true;', :'data-icon' => "ui-icon-pencil"
|
10
|
+
- if element.page == @page
|
11
|
+
=link_to 'Delete', humpyard_element_path(element), :'data-icon' => "ui-icon-trash", :confirm => "Are you sure?", :method => :delete, :remote => true
|
12
|
+
=link_to 'Move', '#', :'data-icon' => "ui-icon-arrow-4", :"data-draghandle"=>true
|
13
|
+
- unless element.unshared?
|
14
|
+
.hy-el-share-info
|
15
|
+
.description
|
16
|
+
= I18n.t("humpyard_cms.shared_state_info.owning_page.#{element.shared_state.to_i}")
|
17
|
+
- unless element.content_data.nil?
|
18
|
+
-# support hooking up additional buttons the editor adornments
|
19
|
+
- custom_partial_path = "/humpyard/elements/#{element.content_data_type.underscore.pluralize.gsub(/^humpyard\/elements/, '')}/buttons"
|
20
|
+
- if template_exists? custom_partial_path , nil, true
|
21
|
+
= render :partial => custom_partial_path, :locals => {:element => element}
|
22
|
+
- else
|
23
|
+
- unless element.unshared?
|
24
|
+
.hy-el-share-info
|
25
|
+
= link_to(I18n.t("humpyard_cms.shared_state_info.with_title.#{element.shared_state.to_i}", :title => element.page.title), element.page.human_url, :'data-icon' => "ui-icon-circle-arrow-e")
|
26
|
+
.description
|
27
|
+
= I18n.t("humpyard_cms.shared_state_info.with_title.#{element.shared_state.to_i}", :title => element.page.title)
|
28
|
+
- else # view mode
|
29
|
+
= render :partial => "/humpyard/elements/show_view", :locals => {:element => element}
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
remove_element('#hy-id-<%=@element.id%>');
|
@@ -0,0 +1 @@
|
|
1
|
+
alert('<%= @error %>');
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.humpyard-tab
|
2
|
+
.humpyard-tab-title
|
3
|
+
Media Content
|
4
|
+
= form.input :asset_id, :as => :select, :collection => Humpyard::Asset.all, :required => true
|
5
|
+
= form.input :float, :as => :select, :collection => [[t('.none'),''],[t('.left'), 'left'], [t('.right'), 'right']], :required => true
|
6
|
+
= form.input :uri
|
7
|
+
%small=t '.uri_description'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
- if element.content_data and element.content_data.asset
|
2
|
+
.media-element{:style => (element.content_data.float.blank? ? '' : "float: #{element.content_data.float};")}
|
3
|
+
= render '/humpyard/assets/show_asset', :asset => element.content_data.asset.content_data, :element => element
|
4
|
+
- else
|
5
|
+
- if can? :manage, Humpyard::Element
|
6
|
+
.media-element{:style => (element.content_data.float.blank? ? '' : "float: #{element.content_data.float};")}
|
7
|
+
%strong.error404
|
8
|
+
Can't find this Media (Error 404)!
|