widget update

This commit is contained in:
Harry Bomrah 2012-11-14 15:28:55 +08:00
parent 5fb32f3867
commit d7d1b9e31b
5 changed files with 1706 additions and 44 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
.widget_gallery {
margin-bottom: 20px;
}
.widget_gallery:after {
display: table;
width: 100%;
content: '';
}
.widget_gallery ul {
list-style: none;
margin: 0;
padding: 0;
}
.widget_gallery li a {
display: block;
}
.widget_gallery li a img {
height: auto;
display: block;
}
/* widget 1 */
.w1 ul {
margin: 0 -1%;
}
.w1 li {
float: left;
margin: 1%;
}
.w1.c2 li { width: 48%; }
.w1.c3 li { width: 31.3333%; }
.w1.c4 li { width: 23%; }
.w1.c5 li { width: 18%; }
.w1.c6 li { width: 14.6666%; }
.w1 li a:hover {
box-shadow: 0 0 20px rgba(0,0,0,0.9);
outline: solid 4px #429DFF;
position: relative;
}
.w1 li a img {
width: 100%;
}
/* widget 2 */
.w2 li {
width: 100%;
}
.w2 li a img {
width: 100%;
height: auto;
}
.w2 li a {
position: relative;
overflow: hidden;
color: #fff;
text-transform: capitalize;
}
.w2 li a .desc {
position: absolute;
bottom: -60px;
opacity: 0;
display: block;
width: 100%;
padding: 5%;
background-color: rgba(8, 166, 255, 0.8);
}

View File

@ -0,0 +1,23 @@
class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
def widget1
@settings = {"vertical"=>2,"horizontal"=>6}
@class = "c" + @settings["horizontal"].to_s
@total = @settings["vertical"] * @settings["horizontal"]
@rnd = Random.new
@images = []
for i in 0..@total-1
@sn = @rnd.rand(0...GalleryImage.count)
if @sn < 0
@sn = @sn * -1
end
image = GalleryImage.skip(@sn).limit(1).first
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
@images << values
end
end
def widget2
end
end

View File

@ -0,0 +1,20 @@
<%= stylesheet_link_tag "widget_gallery" %>
<%# content_for :page_specific_javascript do %>
<%#= javascript_include_tag "cycle" %>
<%# end %>
<div class="four columns">
<h4>Gallery Widget</h4>
<p>WIDGET 1</p>
<div class="widget_gallery w1 <%= @class %>">
<ul>
<% @images.each do |image| %>
<li><a href="<%= image['show_link'] %>" title="photo description 1"><img src="<%= image['thumb'] %>" alt=""/></a></li>
<% end %>
<!-- <li><a href="" title="photo description 2"><img src="images/assets/2.jpg" alt=""/></a></li>
<li><a href="" title="photo description 3"><img src="images/assets/3.jpg" alt=""/></a></li>
<li><a href="" title="photo description 4"><img src="images/assets/4.jpg" alt=""/></a></li>
<li><a href="" title="photo description 5"><img src="images/assets/5.jpg" alt=""/></a></li>
<li><a href="" title="photo description 6"><img src="images/assets/6.jpg" alt=""/></a></li> -->
</ul>
</div>
</div>

View File

@ -1,54 +1,56 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :gallery do namespace :gallery do
namespace :back_end do namespace :back_end do
match "get_albums" => "albums#get_albums" match "get_albums" => "albums#get_albums"
match "upload_image" => "albums#upload_image" match "upload_image" => "albums#upload_image"
match "save_tags" => "tags#save_tags" match "save_tags" => "tags#save_tags"
match "albums/save_tags" => "tags#save_tags" match "albums/save_tags" => "tags#save_tags"
resources :albums do resources :albums do
match "set_cover" => "albums#set_cover" match "set_cover" => "albums#set_cover"
match "imgs" => "albums#imgs" match "imgs" => "albums#imgs"
match "upload_panel" => "albums#upload_panel" match "upload_panel" => "albums#upload_panel"
match "images_tags" => "albums#images_tags" match "images_tags" => "albums#images_tags"
end end
match "album_images/#!/:id" => "album_images#show" match "album_images/#!/:id" => "album_images#show"
resources :album_images resources :album_images
resources :gallery_categories resources :gallery_categories
resources :tags resources :tags
end
end namespace :front_end do
namespace :front_end do match "get_albums" => "albums#get_albums"
match "get_albums" => "albums#get_albums" # match "orbit_galleries" => "orbit_galleries#index"
# match "orbit_galleries" => "orbit_galleries#index" # match "gallery_category_save" => "orbit_galleries#new_category"
# match "gallery_category_save" => "orbit_galleries#new_category" # match "categorylist" => "orbit_galleries#categorylist"
# match "categorylist" => "orbit_galleries#categorylist" # match "gallery_category_delete" => "orbit_galleries#gallery_category_delete"
# match "gallery_category_delete" => "orbit_galleries#gallery_category_delete" # match "add_album" => "orbit_galleries#add_album"
# match "add_album" => "orbit_galleries#add_album" # match "create_album" => "orbit_galleries#create_album"
# match "create_album" => "orbit_galleries#create_album" # match "get_albums" => "orbit_galleries#get_albums"
# match "get_albums" => "orbit_galleries#get_albums" # match "upload_image" => "orbit_galleries#upload_image"
# match "upload_image" => "orbit_galleries#upload_image" # match "upload_panel" => "orbit_galleries#upload_panel"
# match "upload_panel" => "orbit_galleries#upload_panel" # match "get_images" => "orbit_galleries#get_images"
# match "get_images" => "orbit_galleries#get_images" # match "theater" => "orbit_galleries#theater"
# match "theater" => "orbit_galleries#theater" # match "delete_album" => "orbit_galleries#delete_album"
# match "delete_album" => "orbit_galleries#delete_album" # match "edit_album" => "orbit_galleries#edit_album"
# match "edit_album" => "orbit_galleries#edit_album" # match "set_cover" => "orbit_galleries#set_cover"
# match "set_cover" => "orbit_galleries#set_cover" # match "delete_images" => "orbit_galleries#delete_images"
# match "delete_images" => "orbit_galleries#delete_images" # match "update_album" => "orbit_galleries#update_album"
# match "update_album" => "orbit_galleries#update_album" # match "save_tags" => "orbit_galleries#save_tags"
# match "save_tags" => "orbit_galleries#save_tags" resources :albums do
resources :albums do member do
member do get "imgs"
get "imgs" get "theater"
get "theater" end
end end
end resources :album_images
resources :album_images end
end namespace :widget do
match "widget1" => "albums#widget1"
end
end end
end end
end end