Skip to content
Browse files

settings extracted to a separate file

  • Loading branch information...
1 parent fb86466 commit eae95125496033c4df3810f1ad9ac5a41005ede9 @zlorfi committed
Showing with 17 additions and 11 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 README.md
  3. +5 −6 app.rb
  4. +6 −0 config/config.yml_default
  5. +2 −2 views/edit.haml
  6. +1 −1 views/index.haml
  7. +1 −1 views/top_nav.haml
View
1 .gitignore
@@ -5,3 +5,4 @@ meta
.DS_Store
upload/*
public/thumbnails
+config/config.yml
View
2 README.md
@@ -21,7 +21,7 @@
- install `memcached` for production caching
- `bundle exec shotgun config.ru` for development (a bit of a warning, `rack_flash` doesn't seem to work with `shotgun`)
- `bundle exec puma config.ru` for production
-- change the setting of `title`, `username` and `password` and most important `token`
+- rename `./config/config.yml_default` to `./config/config.yml` and change the setting of `title`, `username` and `password` and most important `token`
## TODO
- image handler exception
View
11 app.rb
@@ -50,12 +50,11 @@ class App < Sinatra::Base
#necessary for the DELETE route
use Rack::MethodOverride
- set :title, 'Sinatra Gallery'
- set :username,'gallery'
- set :password,'gallery'
- # make this a huge random number
- # SecureRandom.urlsafe_base64(30, true)
- set :token,'SzXdCtiS4hmt6gXhS4NIahrfL7iH7aUb0DXd-B35'
+ #store the data in a seperate config file
+ YAML::load(File.open('config/config.yml')).symbolize_keys.each do |key, value|
+ set key, value
+ end
+
end
class Picture
View
6 config/config.yml_default
@@ -0,0 +1,6 @@
+title: 'Sinatra Gallery'
+username: 'gallery'
+password: 'gallery'
+# make this a huge random number
+# SecureRandom.urlsafe_base64(30, true)
+token: 'SzXdCtiS4hmt6gXhS4NIahrfL7iH7aUb0DXd-B35'
View
4 views/edit.haml
@@ -22,9 +22,9 @@
%label Title
%input{:type => 'text', :name => 'title', :value => "#{@picture.image_title}"}
.row
- .large-6.columns
+ .small-6.large-6.columns
%a.small.button.info.radius{:href => '/'} Go Back
- .large-6.columns
+ .small-6.large-6.columns
%input{:type => :hidden, :name => "_method", :value => "put"}
%input.small.button.success.radius.right{:type => "submit", :value => "Update"}
%form{:action => "/d/#{@picture.id}", :method => 'post'}
View
2 views/index.haml
@@ -100,7 +100,7 @@
},
afterLoad : function() {
- this.title = 'Bild ' + (this.index + 1) + ' von ' + this.group.length + (this.title ? ' - ' + this.title : '');
+ this.title = 'Bild ' + (this.index + 1) + ' von ' + this.group.length + (this.title ? ' - <strong>' + this.title : '</strong>');
}
});
View
2 views/top_nav.haml
@@ -1,6 +1,6 @@
.large-6.columns
%h3.subheader
- %i.icon-camera-retro.icon-large
+ -#%i.icon-camera-retro.icon-large
%a.title{:href => "/"}
= page_title

0 comments on commit eae9512

Please sign in to comment.
Something went wrong with that request. Please try again.