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

@ -20,7 +20,6 @@ Rails.application.routes.draw do
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"
@ -49,6 +48,9 @@ Rails.application.routes.draw do
end end
resources :album_images resources :album_images
end end
namespace :widget do
match "widget1" => "albums#widget1"
end
end end
end end
end end