Permalink
Browse files

code changes, responsive gallery added

  • Loading branch information...
1 parent 240738c commit d02f42ec9eb45837cebe215ca3af277e1599ca03 @zlorfi committed Mar 25, 2013
View
@@ -19,3 +19,5 @@
## TODO
- image handler exception
+- show flash message with xhr request
+- add jQuery gallery function
View
12 app.rb
@@ -42,16 +42,16 @@ class App < Sinatra::Base
set :scss, Compass.sass_engine_options
set :server, :puma
enable :sessions
- use Rack::Flash#, :sweep => true
+ use Rack::Flash, :sweep => true
#necessary for the DELETE route when using
use Rack::MethodOverride
set :username,'gallery'
+ set :password,'gallery'
# make this a huge random number
# SecureRandom.urlsafe_base64(30, true)
set :token,'SzXdCtiS4hmt6gXhS4NIahrfL7iH7aUb0DXd-B35'
- set :password,'gallery'
end
class Picture
@@ -94,12 +94,14 @@ def admin?
def protected!
halt [ 401, 'Not Authorized' ] unless admin?
+ #flash[:alert] = "Login failed!"
+ #halt haml :index unless admin?
end
def flash_display
response = ""
unless flash.nil?
- flash
+ flash.now[:success] = "Upload successful of"
#flash.each do |name, msg|
# response = response + content_tag(:div, msg, :id => "flash_#{name}")
#end
@@ -156,12 +158,12 @@ def raw(text)
image_date: Time.now
)
- flash.now[:success] = "Upload successful of #{filename}"
+ flash[:success] = "Upload successful of #{filename}" if !request.xhr?
redirect "/i/#{picture.id}" if !request.xhr?
#flash.keep unless request.xhr?
picture.to_json
else
- flash.now[:alert] = 'You have to choose a file first'
+ flash[:alert] = 'You have to choose a file first'
#flash.keep unless request.xhr?
redirect "/upload"
end
View
@@ -0,0 +1,173 @@
+/* Elastislide Style */
+.gallery {
+ width: 100%;
+ max-width: 520px;
+ margin: 0 auto;
+ border-radius: 20px;
+ position: relative;
+ /* background: #000 url(/image/black_denim.png); */
+ box-shadow: 0 2px 1px rgba(255,255,255,0.9), 0 -2px 1px rgba(255,255,255,0.9);
+}
+
+
+.elastislide-list {
+ list-style-type: none;
+ display: none;
+}
+
+.no-js .elastislide-list {
+ display: block;
+}
+
+.elastislide-carousel ul li {
+ min-width: 20px; /* minimum width of the image (min width + border) */
+}
+
+.elastislide-wrapper {
+ position: relative;
+ background-color: #fff;
+ margin: 0 auto;
+ min-height: 60px;
+ box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
+}
+
+.elastislide-wrapper.elastislide-loading {
+ background-image: url(/image/loading.gif);
+ background-repeat: no-repeat;
+ background-position: center center;
+}
+
+.elastislide-horizontal {
+ padding: 10px 40px;
+}
+
+.elastislide-vertical {
+ padding: 40px 10px;
+}
+
+.elastislide-carousel {
+ overflow: hidden;
+ position: relative;
+}
+
+.elastislide-carousel ul {
+ position: relative;
+ display: block;
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+ -webkit-backface-visibility: hidden;
+ -webkit-transform: translateX(0px);
+ -moz-transform: translateX(0px);
+ -ms-transform: translateX(0px);
+ -o-transform: translateX(0px);
+ transform: translateX(0px);
+}
+
+.elastislide-horizontal ul {
+ white-space: nowrap;
+}
+
+.elastislide-carousel ul li {
+ margin: 0;
+ -webkit-backface-visibility: hidden;
+}
+
+.elastislide-horizontal ul li {
+ height: 100%;
+ display: inline-block;
+}
+
+.elastislide-vertical ul li {
+ display: block;
+}
+
+.elastislide-carousel ul li a {
+ display: inline-block;
+ width: 100%;
+}
+
+.elastislide-carousel ul li a img {
+ display: block;
+ border: 2px solid white;
+ max-width: 100%;
+}
+
+/* Navigation Arrows */
+
+.elastislide-wrapper nav span {
+ position: absolute;
+ background: #ddd url(/image/nav.png) no-repeat 4px 3px;
+ width: 23px;
+ height: 23px;
+ border-radius: 50%;
+ text-indent: -9000px;
+ cursor: pointer;
+ opacity: 0.8;
+}
+
+.elastislide-wrapper nav span:hover {
+ opacity: 1.0
+}
+
+.elastislide-horizontal nav span {
+ top: 50%;
+ left: 10px;
+ margin-top: -11px;
+}
+
+.elastislide-vertical nav span {
+ top: 10px;
+ left: 50%;
+ margin-left: -11px;
+ background-position: -17px 5px;
+}
+
+.elastislide-horizontal nav span.elastislide-next {
+ right: 10px;
+ left: auto;
+ background-position: 4px -17px;
+}
+
+.elastislide-vertical nav span.elastislide-next {
+ bottom: 10px;
+ top: auto;
+ background-position: -17px -18px;
+}
+
+// Additional CSS
+
+.elastislide-horizontal {
+ background-color: transparent;
+ border-radius: 20px 20px 0 0;
+}
+
+//.elastislide-horizontal.elastislide-loading {
+// background-image: url(/image/loading_dark.gif);
+//}
+
+.elastislide-carousel ul li a{
+ padding: 2px;
+}
+
+.elastislide-carousel ul li a img {
+ border-radius: 10px;
+ border: none;
+ box-shadow: 0 1px 2px #000;
+}
+
+//.elastislide-wrapper nav span {
+// background-color: #666;
+// box-shadow: inset 0 1px 1px rgba(0,0,0,0.2);
+//}
+
+//.image-preview img {
+// border-radius: 0 0 20px 20px;
+// max-width: 100%;
+// display: block;
+//}
+
+//.elastislide-carousel ul li.current-img a img {
+// box-shadow: 0 0 3px 2px rgba(62,235,255,0.8);
+//}
+
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,5 +1,7 @@
$(document).ready(function() {
$('.alert-box.success').delay(5000).fadeOut(500);
+ $('.alert-box.notice').delay(5000).fadeOut(500);
+ $('.alert-box.alert').delay(9000).fadeOut(500);
var img = new Image();

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit d02f42e

Please sign in to comment.