diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9c9a7b048..e47635dad 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,10 +8,3 @@ ooをできるようにする / oo機能をリファクタリングする / oo - [ ] ooの機能を実装 - [ ] ooのリファクタリング -ちなみにTASKリストの書き方はこんな感じ - -``` -- [ ] ooのテストを実装 -- [ ] ooの機能を実装 -- [ ] ooのリファクタリング -``` diff --git a/.gitignore b/.gitignore index 4469af545..25b5985a1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,9 @@ # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' -# Ignore bundler config. +# Ignore bundler config & bundler gems /.bundle +vendor/bundle # Ignore the default SQLite database. /db/*.sqlite3 diff --git a/.rbenv-version b/.rbenv-version new file mode 100644 index 000000000..2bf1c1ccf --- /dev/null +++ b/.rbenv-version @@ -0,0 +1 @@ +2.3.1 diff --git a/app/models/coder_dojo.rb b/app/models/coder_dojo.rb new file mode 100644 index 000000000..dabc00068 --- /dev/null +++ b/app/models/coder_dojo.rb @@ -0,0 +1,11 @@ +class CoderDojo < ActiveRecord::Base + validates :name, presence: true, length: { maximum: 50 } + validates :course, presence: true, length: { maximum: 25 } + validates :caption, presence: true, length: { maximum: 60 } + validates :venue, presence: true + validates :region, presence: true + validates :logo_image_url, presence: true + validates :redirect_url, presence: true + validates :user_name, presence: true, length: { maximum: 50 } + validates :email, presence: true, length: { maximum: 255 } +end \ No newline at end of file diff --git a/app/models/coder_dojo_list_widget.rb b/app/models/coder_dojo_list_widget.rb new file mode 100644 index 000000000..8f57870c1 --- /dev/null +++ b/app/models/coder_dojo_list_widget.rb @@ -0,0 +1,6 @@ +class CoderDojoListWidget < Widget + attribute :image, :reference + attribute :headline, :html + attribute :tag, :string + attribute :caption, :string +end diff --git a/app/models/footer_widget.rb b/app/models/footer_widget.rb index 29b47d57a..ebd9525e3 100644 --- a/app/models/footer_widget.rb +++ b/app/models/footer_widget.rb @@ -1,4 +1,4 @@ class FooterWidget < Widget attribute :headline, :html - attribute :paragraph, :html + attribute :line, :html end diff --git a/app/views/coder_dojo_list_widget/details.html.erb b/app/views/coder_dojo_list_widget/details.html.erb new file mode 100644 index 000000000..1855248fc --- /dev/null +++ b/app/views/coder_dojo_list_widget/details.html.erb @@ -0,0 +1,4 @@ +<%= scrivito_medium_dialog do %> + <%= scrivito_details_for CoderDojoListWidget.description_for_editor do %> + <% end %> +<% end %> diff --git a/app/views/coder_dojo_list_widget/show.html.erb b/app/views/coder_dojo_list_widget/show.html.erb new file mode 100644 index 000000000..de2cf8465 --- /dev/null +++ b/app/views/coder_dojo_list_widget/show.html.erb @@ -0,0 +1,8 @@ +
+
+ <%= scrivito_image_tag widget, :image, class:'image-responsive center-block clearfix'%> + <%= scrivito_tag :h1, widget, :headline, data: {newlines: false} %> + <%= scrivito_tag :p, widget, :tag, class:'cover-text-white'%> + <%= scrivito_tag :p, widget, :caption, class:'cover-text-white'%> +
+
\ No newline at end of file diff --git a/app/views/coder_dojo_list_widget/thumbnail.html.erb b/app/views/coder_dojo_list_widget/thumbnail.html.erb new file mode 100644 index 000000000..e161995b3 --- /dev/null +++ b/app/views/coder_dojo_list_widget/thumbnail.html.erb @@ -0,0 +1 @@ +<%= scrivito_thumbnail CoderDojoListWidget.description_for_editor %> diff --git a/app/views/footer_widget/show.html.erb b/app/views/footer_widget/show.html.erb index 6d1d66f36..68c435b96 100644 --- a/app/views/footer_widget/show.html.erb +++ b/app/views/footer_widget/show.html.erb @@ -1,7 +1,7 @@
<%= scrivito_tag :h5, widget, :headline, class:'cover-text-white', style:'padding-top:20px;' %> - <%= scrivito_tag :p, widget, :paragraph, class:'cover-text-white', style:'padding-bottom:60; padding-top:20px;' %> + <%= scrivito_tag :div, widget, :line, class:'cover-text-white', style:'padding-bottom:60; padding-top:20px;' %>
diff --git a/config/routes.rb b/config/routes.rb index 779609d99..3d6ef9b59 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -59,4 +59,5 @@ scrivito_route '/', using: 'homepage' scrivito_route '(/)(*slug-):id', using: 'slug_id' scrivito_route '/*permalink', using: 'permalink', format: false + end diff --git a/db/migrate/20160606065215_create_coder_dojos.rb b/db/migrate/20160606065215_create_coder_dojos.rb new file mode 100644 index 000000000..73b84d4ec --- /dev/null +++ b/db/migrate/20160606065215_create_coder_dojos.rb @@ -0,0 +1,17 @@ +class CreateCoderDojos < ActiveRecord::Migration + def change + create_table :coder_dojos do |t| + t.string :name + t.string :course + t.string :caption + t.string :venue + t.integer :region + t.string :logo_image_url + t.string :redirect_url + t.string :user_name + t.string :email + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 000000000..334a1d311 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,30 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20160606065215) do + + create_table "coder_dojos", force: :cascade do |t| + t.string "name" + t.string "course" + t.string "caption" + t.string "venue" + t.integer "region" + t.string "logo_image_url" + t.string "redirect_url" + t.string "user_name" + t.string "email" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/test/fixtures/coder_dojos.yml b/test/fixtures/coder_dojos.yml new file mode 100644 index 000000000..cbcf239db --- /dev/null +++ b/test/fixtures/coder_dojos.yml @@ -0,0 +1,23 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + course: MyString + caption: MyString + venue: MyString + region: 1 + logo_image_url: MyString + redirect_url: MyString + user_name: MyString + email: MyString + +two: + name: MyString + course: MyString + caption: MyString + venue: MyString + region: 1 + logo_image_url: MyString + redirect_url: MyString + user_name: MyString + email: MyString diff --git a/test/models/coder_dojo_test.rb b/test/models/coder_dojo_test.rb new file mode 100644 index 000000000..53ec92d26 --- /dev/null +++ b/test/models/coder_dojo_test.rb @@ -0,0 +1,65 @@ +require 'test_helper' + +class CoderDojoTest < ActiveSupport::TestCase + def setup + @dojo = CoderDojo.new(name: "Example User", + course: "scratch", + caption: "Weekly Event", + venue: "okinawa", + region: '47', + logo_image_url: "https://www.example.com/logo.png", + redirect_url: "https://www.facebook.com", + user_name: "example", + email: "user@example.com") + end + + test "should be valid" do + assert @dojo.valid? + end + + test "name should be present" do + @dojo.name = "c" * 51 + assert_not @dojo.valid? + end + + test "course should be present" do + @dojo.course = "c" * 244 + "@example.com" + assert_not @dojo.valid? + end + + test "caption should be present" do + @dojo.caption = "c " * 60 + assert_not @dojo.valid? + end + + test "venue should be present" do + @dojo.venue = " " + assert_not @dojo.valid? + end + + test "region should be present" do + @dojo.region = ' ' + assert_not @dojo.valid? + end + + test "logo should be present" do + @dojo.logo_image_url = " " + assert_not @dojo.valid? + end + + test "dojo url should be present" do + @dojo.redirect_url = " " + assert_not @dojo.valid? + end + + test "user name should be present" do + @dojo.user_name = "c" * 51 + assert_not @dojo.valid? + end + + test "user email should be present" do + @dojo.email = "c" * 244 + "@example.com" + assert_not @dojo.valid? + end + +end