Skip to content
Browse files

Updating markings for chewbranca.com, adding reference urls

  • Loading branch information...
1 parent 32ffe5b commit f5382c52dae144467f77f02e57e8560ae0651b39 Russell committed Apr 4, 2010
Showing with 95 additions and 61 deletions.
  1. +21 −2 .gitignore
  2. +14 −12 pastiche.rb
  3. +5 −0 views/_form.haml
  4. +26 −22 views/_header.haml
  5. +1 −1 views/application.sass
  6. +1 −1 views/layout.haml
  7. +27 −23 views/snippet.haml
View
23 .gitignore
@@ -1,3 +1,22 @@
-webrat.log
-pastiche.db
+!*.gitignore
+public/uploads
+public/cache/*
+!public/cache/.gitignore
tmp
+.DS_Store
+public/system
+public/javascripts/cache
+public/stylesheets/cache
+*.log
+*.bak
+script/pids
+.*.swp
+.*.swo
+config/*.yml
+config/application.god
+config/deploy/*.rb
+!config/deploy/sample.rb
+*.pid
+*.db
+*.sqlite3
+*.tmproj
View
26 pastiche.rb
@@ -24,12 +24,12 @@ class Pastiche < Sinatra::Base
class User
include DataMapper::Resource
property :id, Serial
- property :openid, String, :nullable => false, :length => 128, :unique_index => :openid
- property :nickname, String, :nullable => false, :length => 16, :unique_index => :nickname
+ property :openid, String, :required => true, :length => 128, :unique_index => :openid
+ property :nickname, String, :required => true, :length => 16, :unique_index => :nickname
property :fullname, String, :length => 128
property :email, String, :length => 128
- property :created_at, DateTime, :nullable => false, :auto_validation => false
- property :updated_at, DateTime, :nullable => false, :auto_validation => false
+ property :created_at, DateTime, :required => true, :auto_validation => false
+ property :updated_at, DateTime, :required => true, :auto_validation => false
has n, :snippets
@@ -41,14 +41,15 @@ class User
class Snippet
include DataMapper::Resource
property :id, Serial
- property :user_id, Integer, :nullable => false
- property :created_at, DateTime, :nullable => false, :auto_validation => false, :index => :created
- property :updated_at, DateTime, :nullable => false, :auto_validation => false, :index => :updated
- property :type, String, :nullable => false, :length => 40
- property :filename, String, :nullable => false, :length => 128
+ property :user_id, Integer, :required => true
+ property :created_at, DateTime, :required => true, :auto_validation => false, :index => :created
+ property :updated_at, DateTime, :required => true, :auto_validation => false, :index => :updated
+ property :type, String, :required => true, :length => 40
+ property :filename, String, :required => true, :length => 128
property :description, String, :length => 512
- property :tabstop, Integer, :nullable => false, :default => 8
- property :text, Text, :nullable => false, :length => 65536
+ property :reference_url, String, :length => 255
+ property :tabstop, Integer, :required => true, :default => 8
+ property :text, Text, :required => true, :length => 65536
belongs_to :user
@@ -344,6 +345,7 @@ def find_snippet(id)
def validate_snippet_parameters
params[:filename].strip!
+ params[:reference_url].strip!
params[:type].strip!
params[:tabstop] = params[:tabstop].to_i
params[:description].strip!
@@ -354,7 +356,7 @@ def validate_snippet_parameters
redirect url_for('/new')
end
- [:filename, :type, :tabstop, :description, :text].inject({}) {|hash, key| hash[key] = params[key]; hash}
+ [:filename, :type, :tabstop, :description, :text, :reference_url].inject({}) {|hash, key| hash[key] = params[key]; hash}
end
def openid_consumer
View
5 views/_form.haml
@@ -16,6 +16,11 @@
.snippet-description
%span.to-be-invisible Description:
%input{ :class => :placeholder, :type => :text, :name => :description, :size => 32, :value => @snippet.description }
+ .snippet-reference_url
+ -#%span.to-be-invisible Reference URL (ie bug ticket):
+ %span Reference URL (ie bug ticket):
+ %br
+ %input{ :class => :placeholder, :type => :text, :name => :reference_url, :size => 32, :value => @snippet.reference_url }
.clear
%textarea{ :name => :text }= @snippet.text
%input{ :type => :submit, :value => @submit_button }
View
48 views/_header.haml
@@ -1,23 +1,27 @@
#header
- .title
- %h1
- %a{ :href => path_to('/')} Pastiche
- .description
- %p Simple Pastebin Application
- .clear
- #navigations
- #login
- - if logged_in?
- logged in as
- %a{ :href => path_to("/user/#{@authd_user.nickname}") }= @authd_user.nickname
- - else
- %a{ :href => path_to('/login')} login
- %ul
- %li
- %a{ :href => path_to('/new') } New snippet
- - if logged_in?
- %li
- %a{ :href => path_to("/user/#{@authd_user.nickname}") } Profile
- %li
- %a{ :href => path_to('/logout') } Logout
- .clear
+ .title
+ %h1
+ %a{ :href => path_to('/')} paste.chewbranca.com
+ .description
+ %p
+ Powered by
+ %a{:href => 'http://github.com/macks/pastiche'} Pastiche
+ .clear
+ #navigations
+ #login
+ - if logged_in?
+ logged in as
+ %a{ :href => path_to("/user/#{@authd_user.nickname}") }= @authd_user.nickname
+ - else
+ %a{ :href => path_to('/login')} login
+ %ul
+ %li
+ %a{ :href => path_to('/') } Latest
+ %li
+ %a{ :href => path_to('/new') } New snippet
+ - if logged_in?
+ %li
+ %a{ :href => path_to("/user/#{@authd_user.nickname}") } Profile
+ %li
+ %a{ :href => path_to('/logout') } Logout
+ .clear
View
2 views/application.sass
@@ -148,7 +148,7 @@ select
+snippet-timestamp
float: right
clear: right
- .snippet-description
+ .snippet-description, .snippet-reference_url
clear: left
width: 60%
padding: 2px
View
2 views/layout.haml
@@ -3,7 +3,7 @@
%html
%head
%meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}
- %title= (@page_title ? "#{@page_title} - " : '') + 'Pastiche'
+ %title= (@page_title ? "#{@page_title} - " : '') + 'paste.chewbranca.com'
%link{:href => path_to("/uv/css/#{Pastiche.uv_theme}.css"), :type => 'text/css', :rel => 'stylesheet'}
%link{:href => path_to("/stylesheets/application.css"), :type => 'text/css', :rel => 'stylesheet'}
%script{:type => 'text/javascript', :src => path_to('/javascripts/jquery.js')}
View
50 views/snippet.haml
@@ -1,25 +1,29 @@
- @page_title = @snippet.filename
.rounded-box
- .snippet.contents
- .snippet-filename
- = @snippet.filename
- .snippet-author
- by
- %a{:href => path_to("/user/#{@snippet.user.nickname}") }= @snippet.user.nickname
- .snippet-datetime
- Modified at
- = render_datetime(@snippet.updated_at)
- .snippet-datetime
- Created at
- = render_datetime(@snippet.created_at)
- - unless @snippet.description.empty?
- .snippet-description= @snippet.description
- .snippet-links
- %a{ :href => path_to("/#{@snippet.id}/download") } download
- %a{ :href => path_to("/#{@snippet.id}/raw/#{@snippet.filename}") } raw
- - if logged_in? && @snippet.user == @authd_user
- %a{ :href => path_to("/#{@snippet.id}/edit") } edit
- %a{ :href => path_to("/#{@snippet.id}/delete") } delete
- .clear
- .snippet-body
- != render_snippet(@snippet, :anchors => true)
+ .snippet.contents
+ .snippet-filename
+ = @snippet.filename
+ .snippet-author
+ by
+ %a{:href => path_to("/user/#{@snippet.user.nickname}") }= @snippet.user.nickname
+ .snippet-datetime
+ Modified at
+ = render_datetime(@snippet.updated_at)
+ .snippet-datetime
+ Created at
+ = render_datetime(@snippet.created_at)
+ - unless @snippet.description.empty?
+ .snippet-description= @snippet.description
+ - unless @snippet.reference_url.empty?
+ .snippet-reference_url
+ Reference URL:
+ %a{:href => @snippet.reference_url}= @snippet.reference_url
+ .snippet-links
+ %a{ :href => path_to("/#{@snippet.id}/download") } download
+ %a{ :href => path_to("/#{@snippet.id}/raw/#{@snippet.filename}") } raw
+ - if logged_in? && @snippet.user == @authd_user
+ %a{ :href => path_to("/#{@snippet.id}/edit") } edit
+ %a{ :href => path_to("/#{@snippet.id}/delete") } delete
+ .clear
+ .snippet-body
+ != render_snippet(@snippet, :anchors => true)

0 comments on commit f5382c5

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