diff --git a/app/models/page_plugin.rb b/app/models/page_plugin.rb index e6c1aa3..9ae9fe6 100644 --- a/app/models/page_plugin.rb +++ b/app/models/page_plugin.rb @@ -11,7 +11,7 @@ def module end def module_class - module_type.constantize + Object.path2class(module_type) end def module_default_name diff --git a/app/views/content/_page.html.erb b/app/views/content/_page.html.erb index 85374f8..44e0fec 100644 --- a/app/views/content/_page.html.erb +++ b/app/views/content/_page.html.erb @@ -1,12 +1,16 @@ <% if page.page_plugins.any? -%> - <% page.page_plugins.each do |plugin| -%> - <%= render :partial => plugin.module_class.view_partial, :locals => { :plugin_module => plugin.module } -%> - <% if logged_in? && get_setting('show_inline_edit_links') %> - <% if current_user.can_author_content? %> - <%= link_to "[Edit]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> - <% elsif current_user.can_approve_content? %> - <%= link_to "[Manage Content]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> + <% page.page_plugins.each_with_index do |plugin, i| -%> + <%# render :partial => plugin.module_class.view_partial, :locals => { :plugin_module => plugin.module } -%> +
+ <%= render :partial => plugin.module.view_partial, :locals => { :plugin_module => plugin.module } -%> + <% if logged_in? && get_setting('show_inline_edit_links') %> +
+ <% if current_user.can_author_content? %> + <%= link_to "[Edit]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> + <% elsif current_user.can_approve_content? %> + <%= link_to "[Manage Content]", edit_admin_page_path(:id => page.id, :anchor => "page-plugin-#{plugin.id}") %> + <% end %> <% end %> - <% end %> +
<% end -%> <% end -%> diff --git a/config/initializers/object_extensions.rb b/config/initializers/object_extensions.rb new file mode 100644 index 0000000..68fce0b --- /dev/null +++ b/config/initializers/object_extensions.rb @@ -0,0 +1,5 @@ +class Object # :nodoc: + def self.path2class(klassname) + klassname.split('::').inject(Object) { |k,n| k.const_get n } + end +end diff --git a/public/javascripts/jquery.jsgal.js b/public/javascripts/jquery.jsgal.js new file mode 100644 index 0000000..c5cabbf --- /dev/null +++ b/public/javascripts/jquery.jsgal.js @@ -0,0 +1,53 @@ +// +// Galeria v1.3 +// Autor: Oscar Linares +// http://www.innovacionweb.com/galeria-accesible-jquery.php +// http://code.google.com/p/galeria-jquery-jsgal/ +// +// Gracias a: +// Ariel Flesler por su plugin jQuery.Preload, aunque al final no lo uso (muy potente, demasiado +// para lo que necesito aquí). +// http://flesler.blogspot.com/2008/01/jquerypreload.html +// Para la precarga me inspire en (muchas gracias) +// http://www.noth.es/2007/11/25/actualizacion-del-jquery-gallery-v-0-2/ +// +(function($) { + // + // plugin + // + $.fn.galimg = function() { + // trabaja con cada elemento + return this.each(function() { + var idCapaGaleria = $(this).attr("id"); + + $("a", this).click(function() { + // otra posibilidad para mostrar el aviso de cargando. + //$("#" + idCapaGaleria + " .imgprin").append("
Cargando...
"); + + var rutaImagen = $(this).attr("href"); + var altImagen = $(this).children("img").attr("alt"); + + $("#" + idCapaGaleria + " .imgprin img").fadeOut("normal").remove(); + + var objImagen = new Image(); + + $(objImagen).load(function() { + $(this).hide(); + + $("#" + idCapaGaleria + " .imgprin").append(this); + + $(this).fadeIn("slow"); + }); + + $(objImagen).attr("src", rutaImagen); + + //$("#" + idCapaGaleria + " .imgprin .jsgalpre").remove(); + + return false; + }); + }); + }; + // + // fin del plugin + // +})(jQuery); \ No newline at end of file diff --git a/public/stylesheets/galimg.css b/public/stylesheets/galimg.css new file mode 100644 index 0000000..be8c292 --- /dev/null +++ b/public/stylesheets/galimg.css @@ -0,0 +1,59 @@ +div.galimg, div.imgprin, .galimg a, .galimg img, .galimg ul, .galimg li { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; +} + +/* fin del reset */ + +.galimg { + position: relative; + background: #fff url(jsgal/loading.gif) no-repeat 50% 50%; + width: 710px; +} + +.imgprin { + /* es necesario para evitar un parpadero al quitar la imagen */ + width: 710px; + height: 510px; +} + +.imgprin img { + background-color: #fff; + border: solid 1px #ccc; + padding: 5px; +} + +.galimg ul { + position: absolute; + top: 420px; + width: 710px; + list-style: none; + text-align: center; +} + +.galimg ul li { + display: inline; + padding-left: 3px; +} + +.galimg ul li a img { + background-color: #fff; + border: solid 1px #ccc; + padding: 3px; +} + +.jsgalpre { + position: absolute; + top: 0; + left: 0; + background-color: #f00; + color: #fff; + padding: 3px; +} diff --git a/vendor/plugins/ansuz_content_section/app/models/ansuz/j_adams/content_section.rb b/vendor/plugins/ansuz_content_section/app/models/ansuz/j_adams/content_section.rb index 44c57ae..4a077bd 100644 --- a/vendor/plugins/ansuz_content_section/app/models/ansuz/j_adams/content_section.rb +++ b/vendor/plugins/ansuz_content_section/app/models/ansuz/j_adams/content_section.rb @@ -17,6 +17,10 @@ def edit_path def self.view_partial "/admin/content_sections/content_section" end + + def view_partial + self.class.view_partial + end end end end diff --git a/vendor/plugins/ansuz_form_builder/app/models/ansuz/j_adams/form_builder.rb b/vendor/plugins/ansuz_form_builder/app/models/ansuz/j_adams/form_builder.rb index 55ba7c7..1c2a7c8 100644 --- a/vendor/plugins/ansuz_form_builder/app/models/ansuz/j_adams/form_builder.rb +++ b/vendor/plugins/ansuz_form_builder/app/models/ansuz/j_adams/form_builder.rb @@ -18,6 +18,10 @@ def self.view_partial "/admin/form_builders/form_builder" end + def view_partial + self.class.view_partial + end + protected def ensure_submit_text if self.submit_text.blank? diff --git a/vendor/plugins/ansuz_photo_album/app/controllers/admin/photo_albums_controller.rb b/vendor/plugins/ansuz_photo_album/app/controllers/admin/photo_albums_controller.rb index 3446129..ab90856 100644 --- a/vendor/plugins/ansuz_photo_album/app/controllers/admin/photo_albums_controller.rb +++ b/vendor/plugins/ansuz_photo_album/app/controllers/admin/photo_albums_controller.rb @@ -1,7 +1,7 @@ class Admin::PhotoAlbumsController < Admin::BaseController unloadable # This is required if you subclass a controller provided by the base rails app - before_filter :load_photo_album, :only => [:show, :update] + before_filter :load_photo_album, :only => [:show, :edit, :update] before_filter :load_photos, :only => [:show] layout 'admin' @@ -17,6 +17,16 @@ def load_photos def show end + def edit + end + def update + if @photo_album.update_attributes(params[:photo_album]) + flash[:notice] = "The Photo Album was updated successfully." + redirect_to admin_photo_album_path(@photo_album) + else + flash.now[:error] = "There was a problem updating the photo album." + render :action => "edit" + end end end diff --git a/vendor/plugins/ansuz_photo_album/app/models/ansuz/j_adams/photo_album.rb b/vendor/plugins/ansuz_photo_album/app/models/ansuz/j_adams/photo_album.rb index 3fa9f5c..aa5b57d 100644 --- a/vendor/plugins/ansuz_photo_album/app/models/ansuz/j_adams/photo_album.rb +++ b/vendor/plugins/ansuz_photo_album/app/models/ansuz/j_adams/photo_album.rb @@ -11,12 +11,30 @@ def edit_path end def self.view_partial - "/photo_albums/photo_album" + case display_type + when 'Gallery' + "/photo_albums/photo_album_gallery" + else + "/photo_albums/photo_album" + end end def self.admin_partial "/admin/photo_albums/photo_album" end + + def self.display_types + ["Lightbox", "Gallery"] + end + + def view_partial + case display_type + when 'Gallery' + "/photo_albums/photo_album_gallery" + else + "/photo_albums/photo_album" + end + end end end end diff --git a/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/edit.html.erb b/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/edit.html.erb new file mode 100644 index 0000000..f6fc5dd --- /dev/null +++ b/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/edit.html.erb @@ -0,0 +1,13 @@ +<%= title "Edit Photo Album" -%> +<% content_for :sidebar do -%> + <%= link_to "Back", admin_photo_album_path(@photo_album), :class => 'button icon back' %> +<% end -%> +<% form_for :photo_album, :url => admin_photo_album_path(@photo_album), :html => { :method => :put } do |f| %> +
+ + <%= form_row "Display Type", f.select(:display_type, Ansuz::JAdams::PhotoAlbum.display_types) -%> +
+
+
+ <%= submit_tag "Update Photo Album" %> or <%= link_to "Cancel", admin_photo_album_path(@photo_album) %> +<% end %> diff --git a/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/show.html.erb b/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/show.html.erb index d2a73e6..34dc43f 100644 --- a/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/show.html.erb +++ b/vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/show.html.erb @@ -1,6 +1,7 @@ <%= title "Photo Album" -%> <% content_for :sidebar do -%> - <%= link_to "Add Photo", new_admin_photo_album_photo_path(@photo_album), :class => 'button icon add' -%> + <%= link_to "Add Photo", new_admin_photo_album_photo_path(@photo_album), :class => 'button icon add' %> + <%= link_to "Edit Settings", edit_admin_photo_album_path(@photo_album), :class => 'button icon edit' %> <% end -%>

Photos