diff --git a/.bundle/config b/.bundle/config index 53c14bd4..977a0915 100644 --- a/.bundle/config +++ b/.bundle/config @@ -1,4 +1,4 @@ --- BUNDLE_DISABLE_SHARED_GEMS: "1" -BUNDLE_WITHOUT: production +BUNDLE_WITHOUT: production:test BUNDLE_PATH: bundle diff --git a/Gemfile b/Gemfile index ab60281c..904287c7 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'i18n', '0.4.1' gem 'sinatra', '1.0.0' gem 'sinatra-r18n', '0.4.7.1' gem 'sinatra-logger', '0.1.0' +gem 'sinatra-content-for' gem 'dm-migrations', '1.0.0' gem 'dm-timestamps', '1.0.0' gem 'dm-validations', '1.0.0' @@ -14,25 +15,24 @@ gem 'dm-pager', '1.1.0' gem 'dm-tags', '1.0.0' gem 'builder', '2.1.2' gem 'haml', '3.0.17' -gem 'fastercsv' -gem 'rake' -gem 'shotgun' -gem 'exceptional' -gem 'thin' +gem 'rake', '0.8.7' +gem 'shotgun', '0.8' +gem 'exceptional', '2.0.25' +gem 'erubis', '2.6.6' +gem 'activesupport', '3.0.0' group :production do gem 'dm-postgres-adapter', '1.0.0' end group :development do - gem 'dm-sqlite-adapter' + gem 'dm-sqlite-adapter', '1.0.2' end group :test do gem 'shoulda', '2.11.3' - gem 'rack-test', :require => 'rack/test' - gem 'dm-sqlite-adapter' - gem 'autotest' - gem 'autotest-growl', :require => 'autotest/growl' - gem 'rcov' + gem 'rack-test', '0.5.4', :require => 'rack/test' + gem 'dm-sqlite-adapter', '1.0.2' + gem 'autotest', '4.3.2' + gem 'autotest-growl', '0.2.5', :require => 'autotest/growl' end diff --git a/Gemfile.lock b/Gemfile.lock index a58e1ed9..cbc83699 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,22 +1,22 @@ GEM remote: http://rubygems.org/ specs: + abstract (1.0.0) + activesupport (3.0.0) addressable (2.2.0) autotest (4.3.2) - autotest-growl (0.2.4) - autotest (>= 4.2.4) + autotest-growl (0.2.5) builder (2.1.2) - daemons (1.1.0) data_objects (0.10.2) addressable (~> 2.1) - dm-aggregates (1.0.0) - dm-core (~> 1.0.0) - dm-core (1.0.0) - addressable (~> 2.1) + dm-aggregates (1.0.2) + dm-core (~> 1.0.2) + dm-core (1.0.2) + addressable (~> 2.2) extlib (~> 0.9.15) - dm-do-adapter (1.0.0) - data_objects (~> 0.10.1) - dm-core (~> 1.0.0) + dm-do-adapter (1.0.2) + data_objects (~> 0.10.2) + dm-core (~> 1.0.2) dm-is-tree (1.0.0) dm-core (~> 1.0.0) dm-migrations (1.0.0) @@ -27,8 +27,8 @@ GEM dm-postgres-adapter (1.0.0) dm-do-adapter (~> 1.0.0) do_postgres (~> 0.10.2) - dm-sqlite-adapter (1.0.0) - dm-do-adapter (~> 1.0.0) + dm-sqlite-adapter (1.0.2) + dm-do-adapter (~> 1.0.2) do_sqlite3 (~> 0.10.2) dm-tags (1.0.0) dm-core (~> 1.0.0) @@ -46,7 +46,8 @@ GEM data_objects (= 0.10.2) do_sqlite3 (0.10.2) data_objects (= 0.10.2) - eventmachine (0.12.10) + erubis (2.6.6) + abstract (>= 1.0.0) exceptional (2.0.25) extlib (0.9.15) fastercsv (1.5.3) @@ -60,50 +61,47 @@ GEM rack-test (0.5.4) rack (>= 1.0) rake (0.8.7) - rcov (0.9.8) shotgun (0.8) rack (>= 1.0) shoulda (2.11.3) sinatra (1.0) rack (>= 1.0) + sinatra-content-for (0.2) + sinatra sinatra-logger (0.1.0) sinatra (>= 0.10.1) sinatra-r18n (0.4.7.1) r18n-core (= 0.4.7.1) stringex (1.1.0) - thin (1.2.7) - daemons (>= 1.0.9) - eventmachine (>= 0.12.6) - rack (>= 1.0.0) uuidtools (2.1.1) PLATFORMS ruby DEPENDENCIES - autotest - autotest-growl + activesupport (= 3.0.0) + autotest (= 4.3.2) + autotest-growl (= 0.2.5) builder (= 2.1.2) dm-is-tree (= 1.0.0) dm-migrations (= 1.0.0) dm-pager (= 1.1.0) dm-postgres-adapter (= 1.0.0) - dm-sqlite-adapter + dm-sqlite-adapter (= 1.0.2) dm-tags (= 1.0.0) dm-timestamps (= 1.0.0) dm-types (= 1.0.0) dm-validations (= 1.0.0) - exceptional - fastercsv + erubis (= 2.6.6) + exceptional (= 2.0.25) haml (= 3.0.17) i18n (= 0.4.1) rack-flash (= 0.1.1) - rack-test - rake - rcov - shotgun + rack-test (= 0.5.4) + rake (= 0.8.7) + shotgun (= 0.8) shoulda (= 2.11.3) sinatra (= 1.0.0) + sinatra-content-for sinatra-logger (= 0.1.0) sinatra-r18n (= 0.4.7.1) - thin diff --git a/README.ja.rdoc b/README.ja.rdoc index d5764699..3dcb67e6 100644 --- a/README.ja.rdoc +++ b/README.ja.rdoc @@ -15,8 +15,8 @@ Rubyで書かれたクラウドの為のCMS。 $ gem install bundler $ git clone git://github.com/komagata/pyha.git $ cd pyha - $ rake install - $ rackup + $ bundle exec rake install + $ bundle exec rackup http://localhost:9292/ を見る。 diff --git a/README.rdoc b/README.rdoc index e969e7a6..ebb2cf64 100644 --- a/README.rdoc +++ b/README.rdoc @@ -15,8 +15,8 @@ CMS written in Ruby for cloud computing. $ gem install bundler $ git clone git://github.com/komagata/pyha.git $ cd pyha - $ rake install - $ rackup + $ bundle exec rake install + $ bundle exec rackup View at: http://localhost:9292/ diff --git a/Rakefile b/Rakefile index afe41537..20a7fba5 100644 --- a/Rakefile +++ b/Rakefile @@ -105,12 +105,12 @@ task 'db:reset' => %w(db:migrate db:seed) desc 'Bundler' task :bundle do - `bundle install --without production` + `bundle install bundle --without production test` end desc 'Rebundler' task :rebundle do - `bundle install --without production` + `bundle install bundle --without production test` end desc 'Install' diff --git a/config.yml b/config.yml new file mode 100644 index 00000000..cdb71045 --- /dev/null +++ b/config.yml @@ -0,0 +1,4 @@ +production: + dsn: sqlite3://<%= root %>/production.sqlite3 +development: + dsn: sqlite3://<%= root %>/development.sqlite3 diff --git a/i18n/en.yml b/i18n/en.yml new file mode 100644 index 00000000..766a0024 --- /dev/null +++ b/i18n/en.yml @@ -0,0 +1,111 @@ +error: Error +profile: Profile +next: Next +previous: Previous +older_post: Older Post +newer_post: Newer Post +older: Older +newer: Newer +admin: Admin +admin_page: Admin page +dashboard: Dashboard +login: Login +logout: Logout +signup: Signup +users: Users +categories: Categories +posts: Posts +pages: Pages +comments: Comments +themes: Themes +plugins: Plugins +settings: Settings +site: Site +list: List +new: New +edit: Edit +delete: Delete +about: About this site +recent_entries: Recent Entries +tags: Tags +archives: Archives +search: Search +others: Others +feed: Feed +listing_posts: Listing Posts +listing_pages: Listing Pages +listing_categories: Listing Categories +listing_tags: Listing Tags +listing_comments: Listing Comments +listing_users: Listing Users +listing_themes: Listing Themes +listing_plugins: Listing Plugins +new_post: New Post +new_page: New Page +new_category: New Category +new_user: New User +new_comment: New Comment +edit_post: Edit Post +edit_page: Edit Page +edit_category: Edit Category +edit_comment: Edit Comment +edit_user: Edit User +edit_site: Edit Site +are_you_sure: Are you sure? +not_select: Not Select +no_category: No Cateogry +no_tag: No Tag +no_post: No Post +no_page: No Page +no_user: No User +no_comment: No Comment +no_plugin: No Plugin +page: + id: ID + slug: Slug + title: Title + body: Body + user: Author + category: Category + tags: Tags + created_at: Created at + updated_at: Updated at +post: + id: ID + slug: Slug + title: Title + body: Body + user: Author + category: Category + tags: Tags + created_at: Created at + updated_at: Updated at +category: + id: ID + slug: Slug + title: Title + description: Description + created_at: Created at + updated_at: Updated at +user: + id: ID + name: Name + email: Email + password: Password + password_confirmation: Password Confirmation + created_at: Created at + updated_at: Updated at +site: + id: ID + title: Title + description: Description + theme: Theme + created_at: Created at + updated_at: Updated at +comment: + id: ID + name: Name + body: Body + homepage: Homepage + created_at: Created at + updated_at: Updated at diff --git a/i18n/ja.yml b/i18n/ja.yml index a79f1426..efc3d120 100644 --- a/i18n/ja.yml +++ b/i18n/ja.yml @@ -37,7 +37,7 @@ listing_pages: ページ一覧 listing_categories: カテゴリー一覧 listing_tags: タグ一覧 listing_comments: コメント一覧 -listing_users: タグ一覧 +listing_users: ユーザー一覧 listing_themes: テーマ一覧 listing_plugins: プラグイン一覧 new_post: 投稿登録 @@ -59,12 +59,13 @@ no_post: 投稿がありません no_page: ページがありません no_user: ユーザーがいません no_comment: コメントがありません -no_plugin: プラグインがいません +no_plugin: プラグインがありません page: id: ID slug: スラッグ title: タイトル body: 本文 + user: 作成者 category: カテゴリー tags: タグ created_at: 作成日時 @@ -74,6 +75,7 @@ post: slug: スラッグ title: タイトル body: 本文 + user: 作成者 category: カテゴリー tags: タグ created_at: 作成日時 diff --git a/init.rb b/init.rb index 4c61009a..73d9e99e 100644 --- a/init.rb +++ b/init.rb @@ -1,4 +1,5 @@ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'lib')) +$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'plugin', 'hello', 'lib')) require 'rubygems' require 'bundler' diff --git a/install.rb b/install.rb old mode 100644 new mode 100755 index 8fa65a88..33cc0f5c --- a/install.rb +++ b/install.rb @@ -1,3 +1,5 @@ +#!/usr/bin/env ruby + def _run(cmd) puts cmd system cmd @@ -5,5 +7,10 @@ def _run(cmd) Dir.chdir(File.dirname(__FILE__)) -_run 'gem install bundler --pre' -_run 'bundle install bundle --without production' +_run 'gem update --system' +_run 'gem install bundler --no-rdoc --no-ri --version "1.0.0"' +_run 'bundle install bundle --without production test' +_run 'bundle exec rake db:reset' +puts '--- Installation complete ---' +puts 'Press Enter.' +STDIN.getc diff --git a/lib/pyha.rb b/lib/pyha.rb index 46470829..6bd96319 100644 --- a/lib/pyha.rb +++ b/lib/pyha.rb @@ -8,6 +8,7 @@ require 'sinatra/base' require 'sinatra/r18n' require 'sinatra/logger' +require 'sinatra/content_for' require 'dm-core' require 'dm-timestamps' require 'dm-migrations' @@ -30,8 +31,12 @@ require 'pyha/bread_crumb' require 'pyha/before' require 'pyha/helpers' + +require 'pyha/hello' + require 'pyha/app' + module Pyha class NoTemplateError < StandardError; end end diff --git a/lib/pyha/app.rb b/lib/pyha/app.rb index d837294f..6de0b6aa 100644 --- a/lib/pyha/app.rb +++ b/lib/pyha/app.rb @@ -6,6 +6,7 @@ class App < Sinatra::Base set :public => Proc.new { File.join(root, 'public') } set :views => Proc.new { public } set :theme => Proc.new { File.join(public, 'theme') } + set :config => YAML.load(ERB.new(File.read("#{root}/config.yml")).result(binding)) set :supported_templates => %w(erb haml erubis) set :per_page, 10 set :admin_per_page, 50 @@ -17,6 +18,8 @@ class App < Sinatra::Base register Sinatra::R18n register Pyha::Before + register Pyha::Hello + helpers Sinatra::ContentFor helpers Pyha::Helpers use Rack::Session::Cookie, @@ -27,11 +30,11 @@ class App < Sinatra::Base end configure :production do - DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{root}/production.sqlite3") + DataMapper.setup(:default, ENV['DATABASE_URL'] || config['development']['dsn']) end configure :development do - DataMapper.setup(:default, "sqlite3://#{root}/development.sqlite3") + DataMapper.setup(:default, config['development']['dsn']) end get '/admin/' do diff --git a/lib/pyha/helpers.rb b/lib/pyha/helpers.rb index a741e147..5df0a0db 100644 --- a/lib/pyha/helpers.rb +++ b/lib/pyha/helpers.rb @@ -121,6 +121,11 @@ def link_to(name, url, options = {}) attrs[:onclick] = "if(confirm('#{options[:confirm]}')){var f = document.createElement('form');f.style.display = 'none';this.parentNode.appendChild(f);f.method = 'POST';f.action = this.href;var m = document.createElement('input');m.setAttribute('type', 'hidden');m.setAttribute('name', '_method');m.setAttribute('value', '#{options[:method]}');f.appendChild(m);f.submit();};return false" end + options.delete :confirm + options.delete :method + + attrs.update(options) + str = '' attrs.each do |key, value| str += %Q(#{key.to_s}="#{value}") diff --git a/plugin/hello/lib/pyha/hello.rb b/plugin/hello/lib/pyha/hello.rb new file mode 100644 index 00000000..26542470 --- /dev/null +++ b/plugin/hello/lib/pyha/hello.rb @@ -0,0 +1,9 @@ +module Pyha + module Hello + def self.registered(app) + app.get '/hello' do + 'hello' + end + end + end +end diff --git a/public/admin/categories/index.haml b/public/admin/categories/index.haml index 0bbb2d84..ed0e2476 100644 --- a/public/admin/categories/index.haml +++ b/public/admin/categories/index.haml @@ -10,6 +10,6 @@ %a{:href => "/admin/categories/#{category.id}/edit"}= category.title %td= l category.created_at.to_time %td - %a{:href => "/admin/categories/#{category.id}/edit"}= t.edit + %a.button{:href => "/admin/categories/#{category.id}/edit"}= t.edit %td - = link_to t.delete, "/admin/categories/#{category.id}", :confirm => t.are_you_sure, :method => :delete + = link_to t.delete, "/admin/categories/#{category.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete diff --git a/public/admin/entries/index.haml b/public/admin/entries/index.haml index 986a4fdf..b55af957 100644 --- a/public/admin/entries/index.haml +++ b/public/admin/entries/index.haml @@ -15,6 +15,6 @@ %td= entry.created_at %td= entry.updated_at %td - %a{:href => "/admin/entries/#{entry.id}/edit"} Edit + %a.button{:href => "/admin/entries/#{entry.id}/edit"} Edit %td - %a{:href => "/admin/entries/#{entry.id}"} Delete + %a.button{:href => "/admin/entries/#{entry.id}"} Delete diff --git a/public/admin/favicon.ico b/public/admin/favicon.ico index 33942d9a..8cb2d0fe 100644 Binary files a/public/admin/favicon.ico and b/public/admin/favicon.ico differ diff --git a/public/admin/images/add.png b/public/admin/images/add.png new file mode 100644 index 00000000..1aa7f095 Binary files /dev/null and b/public/admin/images/add.png differ diff --git a/public/admin/images/aside_arrow.png b/public/admin/images/aside_arrow.png new file mode 100644 index 00000000..07be7b5b Binary files /dev/null and b/public/admin/images/aside_arrow.png differ diff --git a/public/admin/images/category.png b/public/admin/images/category.png new file mode 100644 index 00000000..65bd0bbd Binary files /dev/null and b/public/admin/images/category.png differ diff --git a/public/admin/images/comment.png b/public/admin/images/comment.png new file mode 100644 index 00000000..f6e83254 Binary files /dev/null and b/public/admin/images/comment.png differ diff --git a/public/admin/images/dashboard.png b/public/admin/images/dashboard.png new file mode 100644 index 00000000..a46fb222 Binary files /dev/null and b/public/admin/images/dashboard.png differ diff --git a/public/admin/images/file.png b/public/admin/images/file.png new file mode 100644 index 00000000..2d7f2d60 Binary files /dev/null and b/public/admin/images/file.png differ diff --git a/public/admin/images/files.png b/public/admin/images/files.png new file mode 100644 index 00000000..8dd48c49 Binary files /dev/null and b/public/admin/images/files.png differ diff --git a/public/admin/images/mail-attachment.png b/public/admin/images/mail-attachment.png new file mode 100644 index 00000000..529bb7f5 Binary files /dev/null and b/public/admin/images/mail-attachment.png differ diff --git a/public/admin/images/plugin.png b/public/admin/images/plugin.png new file mode 100644 index 00000000..d16abcbd Binary files /dev/null and b/public/admin/images/plugin.png differ diff --git a/public/admin/images/post.png b/public/admin/images/post.png new file mode 100644 index 00000000..a9850ee2 Binary files /dev/null and b/public/admin/images/post.png differ diff --git a/public/admin/images/setting.png b/public/admin/images/setting.png new file mode 100644 index 00000000..259ed26d Binary files /dev/null and b/public/admin/images/setting.png differ diff --git a/public/admin/images/theme.png b/public/admin/images/theme.png new file mode 100644 index 00000000..596caf94 Binary files /dev/null and b/public/admin/images/theme.png differ diff --git a/public/admin/images/user.png b/public/admin/images/user.png new file mode 100644 index 00000000..9d2d5008 Binary files /dev/null and b/public/admin/images/user.png differ diff --git a/public/admin/layout.haml b/public/admin/layout.haml index 0073a00b..ad3cb737 100644 --- a/public/admin/layout.haml +++ b/public/admin/layout.haml @@ -1,4 +1,3 @@ -!!! XML !!! %html %head @@ -13,52 +12,55 @@ #header %h1 %a{:href => '/'}= @site.title - #nav - %ul - - if logged_in? - %li= current_user.name - %li - %a{:href => '/admin/logout'}= t.logout - - else - %li - %a{:href => '/admin/login'}= t.login + #nav + %ul + - if logged_in? + %li= link_to current_user.name, "/admin/users/#{current_user.id}/edit" + %li + %a{:href => '/admin/logout'}= t.logout + - else + %li + %a{:href => '/admin/login'}= t.login #content #aside %ul - %li - = t.posts + %li.post.parent + %h3.title= t.posts %ul - %li + %li.list %a{:href => '/admin/posts'}= t.list - %li + %li.new %a{:href => '/admin/posts/new'}= t.new - %li - = t.pages + %li.page.parent + %h3.title= t.pages %ul - %li + %li.list %a{:href => '/admin/pages'}= t.list - %li + %li.new %a{:href => '/admin/pages/new'}= t.new - %li - = t.categories + %li.category.parent + %h3.title= t.categories %ul - %li + %li.list %a{:href => '/admin/categories'}= t.list - %li + %li.new %a{:href => '/admin/categories/new'}= t.new - %li - = t.users + %li.user.parent + %h3.title= t.users %ul - %li + %li.list %a{:href => '/admin/users'}= t.list - %li + %li.new %a{:href => '/admin/users/new'}= t.new - %li - %a{:href => '/admin/themes'}= t.themes - %li - %a{:href => '/admin/plugins'}= t.plugins - %li - %a{:href => '/admin/site/edit'}= t.settings + %li.theme.parent + %h3 + %a{:href => '/admin/themes'}= t.themes + %li.plugin.parent + %h3 + %a{:href => '/admin/plugins'}= t.plugins + %li.setting.parent + %h3 + %a{:href => '/admin/site/edit'}= t.settings #main = yield #footer diff --git a/public/admin/login.haml b/public/admin/login.haml index b5912bf9..86a4477e 100644 --- a/public/admin/login.haml +++ b/public/admin/login.haml @@ -13,15 +13,15 @@ #header %h1 %a{:href => '/'}= @site.title - #nav - %ul - - if logged_in? - %li= current_user.name - %li + #nav + %ul + - if logged_in? + %li= current_user.name + %li %a{:href => '/admin/logout'}= t.logout - - else - %li - %a{:href => '/admin/login'}= t.login + - else + %li + %a{:href => '/admin/login'}= t.login #content #main %h2= t.login diff --git a/public/admin/pages/index.haml b/public/admin/pages/index.haml index 015d4cb9..75767ce1 100644 --- a/public/admin/pages/index.haml +++ b/public/admin/pages/index.haml @@ -1,22 +1,20 @@ %h2= t.listing_pages -%table +%table.pages %tr %th= t.page.title - %th= t.page.category + %th= t.page.user %th= t.page.created_at %th{:colspan => 2} - - @pages.each do |page| - %tr - %td + - @pages.each_with_index do |page, i| + %tr{:class => (i+1).odd? ? 'odd' : 'even'} + %td.title %a{:href => "/admin/pages/#{page.id}/edit"}= page.title - %td - - if page.category - %a{:href => "/admin/categories/#{page.category.id}/edit"}= page.category.title + %td= page.user.name %td= l page.created_at.to_time %td - %a{:href => "/admin/pages/#{page.id}/edit"}= t.edit + %a.button{:href => "/admin/pages/#{page.id}/edit"}= t.edit %td - = link_to t.delete, "/admin/pages/#{page.id}", :confirm => t.are_you_sure, :method => :delete + = link_to t.delete, "/admin/pages/#{page.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete .pager %ul - if @pages.pager.previous_page diff --git a/public/admin/posts/index.haml b/public/admin/posts/index.haml index a4099eeb..8046fdc1 100644 --- a/public/admin/posts/index.haml +++ b/public/admin/posts/index.haml @@ -1,22 +1,20 @@ %h2= t.listing_posts -%table +%table.posts %tr %th= t.post.title - %th= t.post.category + %th= t.post.user %th= t.post.created_at %th{:colspan => 2} - - @posts.each do |post| - %tr - %td + - @posts.each_with_index do |post, i| + %tr{:class => (i+1).odd? ? 'odd' : 'even'} + %td.title %a{:href => "/admin/posts/#{post.id}/edit"}= post.title - %td - - if post.category - %a{:href => "/admin/categories/#{post.category.id}/edit"}= post.category.title + %td= post.user.name %td= l post.created_at.to_time %td - %a{:href => "/admin/posts/#{post.id}/edit"}= t.edit + %a.button{:href => "/admin/posts/#{post.id}/edit"}= t.edit %td - = link_to t.delete, "/admin/posts/#{post.id}", :confirm => t.are_you_sure, :method => :delete + = link_to t.delete, "/admin/posts/#{post.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete .pager %ul - if @posts.pager.previous_page diff --git a/public/admin/style.css b/public/admin/style.css index 781f4e59..bedb9fb2 100644 --- a/public/admin/style.css +++ b/public/admin/style.css @@ -1,9 +1,216 @@ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { +background:none repeat scroll 0 0; +border:0 none; +margin:0; +outline:0 none; +padding:0; +} + +input, textarea, select { +-webkit-border-radius:6px; +-moz-border-radius:6px; +border-radius:6px; +background:none repeat scroll 0 0 #eee; +border-color:#999 #ccc #ccc #999; +border-style:solid; +border-width:1px; +padding:3px 2px; +} +input:focus, textarea:focus, select:focus { +background:none repeat scroll 0 0 #fafafa; +} + +select, input, button, textarea, button, .button { +font:99% arial,helvetica,clean,sans-serif; +} + +input, button, textarea, select, optgroup, option, .button { +font-family:inherit; +font-size:inherit; +font-style:inherit; +font-weight:inherit; +} + +input[type="submit"], +.button { +cursor:pointer; +border-color:#ccc #999 #999 #ccc; +border-style:solid; +border-width:1px; +margin-bottom:40px; +padding:5px 15px; +-webkit-border-radius:6px; +-moz-border-radius:6px; +border-radius:6px; +background:none repeat scroll 0 0 #ccc; +background:-moz-linear-gradient(#ccc, #bbb) repeat scroll 0 0 transparent; +background: -webkit-gradient(linear, 0 0, 0 bottom, from(#ccc), to(#bbb)); +background: linear-gradient(#ccc, #bbb); +-webkit-box-shadow:1px 1px 2px #bbb; +-moz-box-shadow:1px 1px 2px #bbb; +box-shadow:1px 1px 2px #bbb; +} + + + +.button:link, .button:visited { +color:#444; +} +.button:hover, .button:active ,input[type="submit"]:focus { +background:-moz-linear-gradient(#e8e8e8, #eee) repeat scroll 0 0 transparent; +background: -webkit-gradient(linear, 0 0, 0 bottom, from(#e8e8e8), to(#eee)); +background: linear-gradient(#e8e8e8, #eee); +color:#000; +text-shadow:1px 1px 0 #FFFFFF; +-webkit-box-shadow:none; +-moz-box-shadow:none; +box-shadow:none; +} + + + + +form p { + display:block; + margin-bottom:15px; +} + +input[type="text"], +input[type="password"] { + display:block; + width:550px; +} + +textarea { + display:block; + width:550px; + height:450px; +} +textarea#site_description { + height:50px; +} + +html,body { + margin: 0; + padding: 0; + height: 100%; + font-size: 12px; + background-color: #41527e; +} + +.clear { + display: inline-block; +} + +.clear:after { + content: ""; + display: block; + clear: both; +} + +html, body { + height: 100%; + margin: 0; + padding: 0; +} + +h1 { + margin: 0; + padding: 0; + font-size: 12px; +} + +h2 { + font-size: 16px; + display: block; + background-color: #666; + margin-top: -10px; + margin-right: -20px; + margin-bottom: 15px; + margin-left: -20px; + padding-top: 8px; + padding-right: 20px; + padding-bottom: 8px; + padding-left: 20px; + -webkit-border-radius:7px 7px 0px 0px; + -moz-border-radius:7px 7px 0px 0px; + border-radius:7px 7px 0px 0px; + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: #aaa; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#aaa), to(#ccc)); + background: -moz-linear-gradient(#aaa, #ccc); + background: linear-gradient(#aaa, #ccc); + text-shadow:#eee 1px 1px 0px; +} + +a { + color: #000; + text-decoration: none; +} + +label { + font-weight: bold; +} + +#header { + border-bottom: 1px solid #182b5a; + background: #41527E; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#41527E), to(#212F54)); + background: -moz-linear-gradient(#41527E, #212F54); + background: linear-gradient(#41527E, #212F54); + height: 22px; + padding: 15px; + margin-top: 0; + margin-right: 0; + margin-bottom: 10px; + margin-left: 0; +} + +#header a { + color: #fff; + line-height: 22px; + text-shadow:#222 1px 1px 0px; +} +#header h1 { + font-size:22px; + float: left; +} + #nav { - position: absolute; - top: 1em; - right: 1em; + float: right; + font-size: 11px; + line-height: 12px; } +#nav a { + color: #fff; + border: 1px solid #14203F; + text-align: center; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + display: block; + float: right; + margin-left: 8px; + padding-right: 12px; + padding-left: 12px; + } +#nav a:link, +#nav a:visited { + background: #23325b; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#6B799E), to(#374772)); + background: -moz-linear-gradient(#20325f, #0c1a3f); + background: linear-gradient(#6B799E, #374772); + } +#nav a:hover, +#nav a:active { + background: #0B183B; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#0c1a3f), to(#040c23)); + background: -moz-linear-gradient(#0c1a3f, #040c23); + background: linear-gradient(#0c1a3f, #040c23); + } + #nav ul { margin: 0; padding: 0; @@ -15,39 +222,337 @@ display: inline; } +#content { + overflow: hidden !important; + overflow: visible; + min-height: 100%; + height: auto !important; + height: 100%; + clear: both; + padding-left: 10px; + padding-right: 10px; + padding-bottom: 25px; +} + +#aside { + padding-bottom: 32767px !important; + margin-bottom: -32767px !important; + float: left; + height: 100px; + width: 160px; + overflow: hidden; + padding-right: 0; + padding-bottom: 8px; + padding-left: 0; + clear: left; + position: relative; +} + #main { - margin-left: 150px; + padding-bottom: 32767px !important; + margin-bottom: -32767px !important; + height: 100%; + padding-top: 10px; + padding-right: 20px; + padding-bottom: 10px; + padding-left: 20px; + background-color: #FFF; + margin-left: 170px; + border: 1px solid #182b5a; + -webkit-border-radius:8px; + -moz-border-radius:8px; + border-radius:8px; +} + +#main table { + border-collapse: collapse; + border-spacing: 0; + min-width:700px; + width: auto !important; + width: 700px; +} +#main table tr { + border-bottom-width: 1px; + border-bottom-style: dotted; + border-bottom-color: #aaa; +} +#main table a { + border-collapse: collapse; + border-spacing: 0; + min-width:600px; + width: auto !important; + width: 600px; +} + + + +#main table tr.odd { + background-color: #f4f4f4; +} + +#main table td { + padding: 10px 20px; +} + +#main table td.title { + background: url(images/file.png) no-repeat scroll 10px 50% transparent; + padding-left: 30px; } .admin_login #main { margin: auto; } - -#aside { - float: left; - width: 150px; +#aside h3 { + margin: 0; + padding: 0; + font-size: 11px; } #aside ul { + margin: 0; + padding: 0; + list-style: none; +} + +#aside ul li.parent { + line-height: 22px; + font-weight: bold; + display: block; + margin-bottom: 10px; +} +#aside li.parent ul { + background-color: #eee; + -webkit-border-radius: 0px 0px 6px 6px; + -moz-border-radius: 0px 0px 6px 6px; + border-radius: 0px 0px 6px 6px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-color: #333; + border-bottom-color: #333; + border-left-color: #333; + padding-left: 12px; + padding-bottom: 3px; + clear: both; + padding-top: 5px; + display: block; + padding-right: 12px; +} +#aside ul li ul li { + font-weight: normal; +} +#aside li.list { +/* + background: url(images/files.png) no-repeat scroll 10px 50% transparent; +*/ +} +#aside ul li ul li a { + padding-left: 23px; + display:block; + margin-bottom: 3px; + padding-right: 10px; + line-height: 22px; + height: 22px; + background-repeat: no-repeat; +} +#aside ul li ul li a:hover, +#aside ul li ul li a:active { + -webkit-border-radius:6px; + -moz-border-radius:6px; + border-radius:6px; + background-color:#ddd; + background-image: url(images/aside_arrow.png); + background-position: 10px center; +} + +#aside li.new { +/* + background: url(images/add.png) no-repeat scroll 10px 50% transparent; +*/ +} +#aside li.post h3 { + background: url(images/post.png); +} + +#aside li.page h3 { + background: url(images/file.png); } +#aside li.category h3 { + background: url(images/category.png); +} + +#aside li.user h3 { + background: url(images/user.png); +} + +#aside li.theme h3 a { + background: url(images/theme.png); +} + +#aside li.plugin h3 a { + background: url(images/plugin.png); +} + +#aside li.setting h3 a { + background: url(images/setting.png); +} + +#aside li.parent h3.title { + padding-left: 28px; + background-color: #444; + display: block; + background-repeat: no-repeat; + background-position: 8px 50%; + background-attachment: scroll; + padding-top: 4px; + padding-right: 8px; + padding-bottom: 4px; + color: #fff; + border: 1px solid #333; + -webkit-border-radius: 6px 6px 0px 0px ; + -moz-border-radius: 6px 6px 0px 0px ; + border-radius: 6px 6px 0px 0px ; +} +#aside li.parent h3 a { + color: #fff; + padding-left: 28px; + display: block; + background-repeat: no-repeat; + background-position: 8px 50%; + background-attachment: scroll; + padding-top: 4px; + padding-right: 8px; + padding-bottom: 4px; + color: #fff; + border: 1px solid #333; + -webkit-border-radius: 6px 6px 0px 0px ; + -moz-border-radius: 6px 6px 0px 0px ; + border-radius: 6px 6px 0px 0px ; +} +#aside li.parent h3 a:link, +#aside li.parent h3 a:visited { + background-color: #444; +} +#aside li.parent h3 a:hover, +#aside li.parent h3 a:active { + background-color: #595959; + text-shadow:#222 1px 1px 0px; +} #footer { - clear: both; - text-align: center; + clear: both; + border-top: 1px solid #333; + background: #343434; + text-align: center; + margin-top: 10px; + padding-top: 15px; + padding-right: 0px; + padding-bottom: 15px; + padding-left: 0px; } ul.themes { - list-style: none; + list-style: none; + display: block; + padding: 0px; +} +ul.themes div { + display:block; + float: none; + text-align: center; +} +ul.themes div.title a { + font-size: 13px; + font-weight: bold; + display:block; + padding-top: 4px; + padding-bottom: 4px; + -webkit-border-radius: 4px 4px 0px 0px ; + -moz-border-radius: 4px 4px 0px 0px ; + border-radius: 4px 4px 0px 0px ; + border: 1px solid #333; +} +ul.themes div.title a:link, +ul.themes div.title a:visited { + background-color: #444; + color: #FFF; +} +ul.themes div.title a:hover, +ul.themes div.title a:active { + background-color: #595959; + text-shadow:#222 1px 1px 0px; +} +ul.themes div.screenshot { + display:block; + height:170px; + float: none; + text-align: center; + padding-top: 15px; + padding-bottom: 15px; + -webkit-border-radius: 0px 0px 4px 4px; + -moz-border-radius: 0px 0px 4px 4px; + border-radius: 0px 0px 4px 4px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-color: #999; + border-bottom-color: #999; + border-left-color: #999; +} +ul.themes div.screenshot img { +-webkit-box-shadow: #666 0px 2px 3px; +-moz-box-shadow: #666 0px 2px 3px; +box-shadow: #666 0px 2px 3px; +width: 240px; +height: 170px; +max-width: 240px; +max-height: 170px; +width:auto !important; +height:auto !important; +} +ul.themes div.screenshot span { + line-height: 150px; +} +#main li.theme { + float: left; + padding: 0; + margin: 10px; + background-color: #EDEDED; + width: 280px; + display: block; } -li.theme { - float: left; - padding: 0; - margin: 10px; - width: 310px; +#error { + width:510px; + background-color: #e8c5c5; + margin-bottom: 25px; + padding-top: 10px; + padding-right: 20px; + padding-bottom: 10px; + padding-left: 20px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +#error ul { + padding-left: 25px; + list-style-position: outside; +} +#error .title { + list-style-position: outside; + font-weight: bold; + display: block; + margin-bottom: 2px; } -li.theme .screenshot img { - max-width: 300px; +#error li { + margin-bottom: 3px; } diff --git a/public/admin/themes/index.haml b/public/admin/themes/index.haml index f216ed08..fd0770a7 100644 --- a/public/admin/themes/index.haml +++ b/public/admin/themes/index.haml @@ -7,3 +7,6 @@ - if theme.screenshot .screenshot %img{:src => theme.screenshot} + - else + .screenshot + %span no screenshot diff --git a/public/admin/users/index.haml b/public/admin/users/index.haml index f99987eb..b27115b6 100644 --- a/public/admin/users/index.haml +++ b/public/admin/users/index.haml @@ -1,20 +1,20 @@ %h2= t.listing_users -%table +%table.users %tr %th= t.user.name %th= t.user.email %th= t.user.created_at %th{:colspan => 2} - - @users.each do |user| - %tr - %td + - @users.each_with_index do |user, i| + %tr{:class => (i+1).odd? ? 'odd' : 'even'} + %td.name %a{:href => "/admin/users/#{user.id}/edit"}= user.name %td= user.email %td= l user.created_at.to_time %td - %a{:href => "/admin/users/#{user.id}/edit"}= t.edit + %a.button{:href => "/admin/users/#{user.id}/edit"}= t.edit %td - = link_to t.delete, "/admin/users/#{user.id}", :confirm => t.are_you_sure, :method => :delete + = link_to t.delete, "/admin/users/#{user.id}", :class => 'button', :confirm => t.are_you_sure, :method => :delete .pager %ul - if @users.pager.previous_page diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index 5856e1d0..00000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/system/favicon.ico b/public/system/favicon.ico index 33942d9a..8cb2d0fe 100644 Binary files a/public/system/favicon.ico and b/public/system/favicon.ico differ diff --git a/public/theme/p0t/entry.haml b/public/theme/p0t/entry.haml index 48d8ab3e..bb016a42 100644 --- a/public/theme/p0t/entry.haml +++ b/public/theme/p0t/entry.haml @@ -1 +1,16 @@ = partial :article, :locals => {:post => @entry} +%ul + - @entry.comments.each do |comment| + %li + .body= comment.body + .name= comment.name +%form{:action => '', :method => 'post', :id => 'comment_form'} + %p + %label{:for => 'comment_name'}= t.comment.name + %br + %input{:type => 'text', :name => 'comment[name]', :id => 'comment_name'} + %p + %label{:for => 'comment_body'}= t.comment.body + %br + %textarea{:name => 'comment[body]', :id => 'comment_body', :cols => 40, :rows => 10} + %input{:type => 'submit'} diff --git a/public/theme/p0t/logo.png b/public/theme/p0t/images/logo.png similarity index 100% rename from public/theme/p0t/logo.png rename to public/theme/p0t/images/logo.png diff --git a/public/theme/p0t/quote.gif b/public/theme/p0t/images/quote.gif similarity index 100% rename from public/theme/p0t/quote.gif rename to public/theme/p0t/images/quote.gif diff --git a/public/theme/p0t/layout.haml b/public/theme/p0t/layout.haml index 9787ca66..57703f36 100644 --- a/public/theme/p0t/layout.haml +++ b/public/theme/p0t/layout.haml @@ -5,7 +5,10 @@ %meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8'} %meta{'http-equiv' => 'Content-Style-Type', 'content' => 'text/css'} %meta{'http-equiv' => 'Content-Script-Type', 'content' => 'text/javascript'} - %title== #{@site.title} + - if entry? + %title== #{@entry.title} - #{@site.title} + - else + %title= @site.title %link{:rel => 'shortcut icon', :href => "#{@theme.path}/favicon.ico"} %link{:title => @site.title, :rel => 'alternate', :href => '/index.atom', :type => 'application/atom+xml'} %link{:rel => 'stylesheet', :href => "#{@theme.path}/style.css", :type => 'text/css'} diff --git a/public/theme/p0t/style.css b/public/theme/p0t/style.css index 3504cbb3..29a835e5 100644 --- a/public/theme/p0t/style.css +++ b/public/theme/p0t/style.css @@ -107,7 +107,7 @@ blockquote { border-top: 8px solid #ec189a; padding: 1em 0 0 1em; height: 110px; - background: url(logo.png) no-repeat; + background: url(images/logo.png) no-repeat; background-color: black; } #header .description { diff --git a/public/theme/pyha-cc/favicon.ico b/public/theme/pyha-cc/favicon.ico index 5856e1d0..8cb2d0fe 100644 Binary files a/public/theme/pyha-cc/favicon.ico and b/public/theme/pyha-cc/favicon.ico differ diff --git a/public/theme/pyha-cc/index.haml b/public/theme/pyha-cc/index.haml index 2f67ac02..43da045a 100644 --- a/public/theme/pyha-cc/index.haml +++ b/public/theme/pyha-cc/index.haml @@ -1,7 +1,5 @@ +- page = Page.first(:slug => 'home') .section .title - %h3 ああああああああああああ - .body - %p ああああああああああああああああああああああああああああああああああ - %p ああああああああああああああああああああああああああああああああああ - %p ああああああああああああああああああああああああああああああああああ + %h3= page.title + .body= page.body diff --git a/public/theme/pyha-cc/layout.haml b/public/theme/pyha-cc/layout.haml index 22065eaf..b8ab2557 100644 --- a/public/theme/pyha-cc/layout.haml +++ b/public/theme/pyha-cc/layout.haml @@ -23,13 +23,8 @@ .capture= link_to 'download', 'http://github.com/komagata/pyha' .nav %ul - %li.home= link_to 'ホーム', '/' %li= link_to 'はじめよう', '/' - %li= link_to 'ドキュメント', '/' - %li= link_to 'フォーラム', '/' - %li= link_to 'ダウンロード', '/' - %li= link_to 'テーマ', '/' - %li= link_to 'プラグイン', '/' + %li= link_to 'ダウンロード', 'http://github.com/komagata/pyha/zipball/master' #container #main = yield @@ -42,42 +37,5 @@ - Post.recent(5).each do |post| %li= link_to post.title, post.link #footer - .sections - .section - %h3 ああああああああああ - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - .section - %h3 ああああああああああ - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - .section - %h3 ああああああああああ - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' - %ul - %li= link_to 'ああああああああ', '' .copy pyha diff --git a/pyha.exe b/pyha.exe new file mode 100644 index 00000000..92256c30 Binary files /dev/null and b/pyha.exe differ diff --git a/pyha.exy b/pyha.exy new file mode 100644 index 00000000..dedc2d10 --- /dev/null +++ b/pyha.exy @@ -0,0 +1,15 @@ +general: + startup: pyha.rb + core: cui + kcode: none + +file: + pyha.rb: + +resource: + icon: + - + width : 48 + height: 48 + color : 32 + file : pyha.ico diff --git a/pyha.ico b/pyha.ico new file mode 100644 index 00000000..8cb2d0fe Binary files /dev/null and b/pyha.ico differ diff --git a/pyha.rb b/pyha.rb new file mode 100755 index 00000000..1f2341db --- /dev/null +++ b/pyha.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +def _run(cmd) + puts cmd + system cmd +end + +Dir.chdir(File.dirname(__FILE__)) + +puts 'Show http://localhost:9393/' +_run 'bundle exec shotgun' diff --git a/setup.exe b/setup.exe new file mode 100644 index 00000000..b9e4faa0 Binary files /dev/null and b/setup.exe differ diff --git a/setup.exy b/setup.exy new file mode 100644 index 00000000..dba5644b --- /dev/null +++ b/setup.exy @@ -0,0 +1,15 @@ +general: + startup: install.rb + core: cui + kcode: none + +file: + install.rb: + +resource: + icon: + - + width : 48 + height: 48 + color : 32 + file : setup.ico diff --git a/setup.ico b/setup.ico new file mode 100644 index 00000000..5999baa4 Binary files /dev/null and b/setup.ico differ diff --git a/test/pyha/app_test.rb b/test/pyha/app_test.rb index f5bd89b9..620beb5c 100644 --- a/test/pyha/app_test.rb +++ b/test/pyha/app_test.rb @@ -1,4 +1,5 @@ require File.dirname(__FILE__) + '/../test_helper' +require 'pyha' require 'pyha/app' class AppTest < Test::Unit::TestCase