Skip to content

Commit

Permalink
Merge pull request #33 from springhackathon/develop
Browse files Browse the repository at this point in the history
v0.1.2リリース ok
  • Loading branch information
Gaddict committed Sep 13, 2015
2 parents 6a4780a + 6c474b9 commit 05de3da
Show file tree
Hide file tree
Showing 28 changed files with 328 additions and 27 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ gem "sprockets", '2.12.3'

gem 'whenever', '~> 0.9.0', :require => false

gem 'rails-erd', '1.4.2'

gem 'annotate'

group :development, :test do
gem 'rb-readline', '0.5.3'
gem 'rspec', '~> 3.0'
Expand All @@ -49,6 +53,7 @@ group :development, :test do
gem 'guard-rspec', '4.6.4'
# gem 'mysql2', '0.3.20'
gem 'pg', '0.18.3'
gem 'meta_request'
end

group :test do
Expand Down
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
annotate (2.6.10)
activerecord (>= 3.2, <= 4.3)
rake (~> 10.4)
arel (6.0.3)
bcrypt (3.1.10)
better_errors (2.1.1)
Expand All @@ -48,6 +51,7 @@ GEM
buftok (0.2.0)
builder (3.2.2)
byebug (6.0.2)
callsite (0.0.11)
capistrano (3.4.0)
i18n
rake (>= 10.0.0)
Expand Down Expand Up @@ -118,6 +122,7 @@ GEM
multipart-post (>= 1.2, < 3)
ffi (1.9.8)
formatador (0.2.5)
git-version-bump (0.15.1)
globalid (0.3.6)
activesupport (>= 4.1.0)
guard (2.12.9)
Expand Down Expand Up @@ -175,6 +180,10 @@ GEM
mime-types (>= 1.16, < 3)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
meta_request (0.3.4)
callsite (~> 0.0, >= 0.0.11)
rack-contrib (~> 1.1)
railties (>= 3.0.0, < 5.0.0)
method_source (0.8.2)
mime-types (2.6.1)
mini_portile (0.6.2)
Expand Down Expand Up @@ -209,6 +218,9 @@ GEM
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.4)
rack-contrib (1.4.0)
git-version-bump (~> 0.15)
rack (~> 1.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.4)
Expand Down Expand Up @@ -366,6 +378,7 @@ PLATFORMS
ruby

DEPENDENCIES
annotate
better_errors (~> 2.0)
byebug (= 6.0.2)
capistrano (~> 3.0)
Expand All @@ -383,6 +396,7 @@ DEPENDENCIES
jbuilder (= 2.3.1)
jquery-rails (= 4.0.5)
less-rails (= 2.7.0)
meta_request
oauth (~> 0.4.0)
omniauth (~> 1.2.0)
omniauth-twitter (= 1.2.1)
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# harmox v0.1
# harmox v0.1.2
![logo](app/assets/images/main_logo.png)

役立つボットをつくってみよう 情報収集はTwitterで
Expand All @@ -16,10 +16,14 @@

|project|detail|
|:--:|:--:|
|harmox-script|スクリプト|
|~~harmox-script~~|~~スクリプト~~|
|harmox-admin|管理画面|
|harmox-user|ユーザ画面|
|harmox-analytics|分析画面|
|~~harmox-analytics~~|~~分析画面~~|

# 使い方
Twitterでログインしてください
ボット管理、スケジュール管理ができます

# ルール

Expand All @@ -40,7 +44,7 @@
## ラベルについて
* 大体以下のような形で
* ラベルを追加したらここに追記して下さい

### 必須ラベル

|label|詳細|
Expand Down
Binary file added app/assets/images/landing0.1.2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,21 @@
*= require_self
*/

th {
text-align: center;
}

td.center {
text-align: center;
vertical-align: middle;
}

.main_div {
background-color: #fff;
border-radius: 30px 30px 30px 30px;
}

.main_application {
.main_application {
position: absolute;
top: 8px;
left: 8px;
Expand All @@ -44,3 +53,7 @@
.main_footer {
padding-top: 30px;
}

footer > nav > p {
padding-bottom: 20px;
}
17 changes: 17 additions & 0 deletions app/assets/stylesheets/bot/hash_tags.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// Place all the styles related to the bot/hash_tags controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.hash_tag_select {
width: 100%;
}

.time_select {
width: 100px;
display:inline;
}

.center {
text-align: center;
}

.question {
width: 400px;
}
8 changes: 5 additions & 3 deletions app/assets/stylesheets/home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// display: table-cell;
width: 90vw;
margin-top: 20px;
margin-bottom: 45px;
position: relative;
margin-left: -20px;
}
Expand All @@ -17,10 +18,10 @@

.landing_text {
position: absolute;
top: 10%;
top: 5%;
left: 0%;
right: 0;
bottom: 0;
right: 0%;
bottom: 0%;
margin: auto;
width: 100%;
height: 100%;
Expand All @@ -30,5 +31,6 @@
}

.landing_img {
width: 100%;
border-radius: 30px 30px 30px 30px;
}
8 changes: 6 additions & 2 deletions app/controllers/bot/hash_tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ def create
attr = params.require(:hash_tag).permit(:hash_tag)

if HashTag.find_by_hash_tag(attr[:hash_tag]).nil?
HashTag.create(attr)
redirect_to hash_tags_path
hash_tag = HashTag.create(attr)
if hash_tag.save
redirect_to hash_tags_path
else
redirect_to(new_hash_tag_path, alert: "HashTagを入力してください")
end
else
redirect_to(new_hash_tag_path, alert: "すでに登録されているHashTagです")
end
Expand Down
15 changes: 15 additions & 0 deletions app/models/bot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# == Schema Information
#
# Table name: bots
#
# id :integer not null, primary key
# user_id :integer not null
# twitter_name :string
# twitter_id :string not null
# access_token :string
# access_secret :string
# deleted :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#

class Bot < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
Expand Down
12 changes: 12 additions & 0 deletions app/models/bot_hash_tag_rel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# == Schema Information
#
# Table name: bot_hash_tag_rels
#
# id :integer not null, primary key
# bot_id :integer
# hash_tag_id :integer
# deleted :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#

class BotHashTagRel < ActiveRecord::Base
belongs_to :bot
belongs_to :hash_tag
Expand Down
13 changes: 13 additions & 0 deletions app/models/hash_tag.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
# == Schema Information
#
# Table name: hash_tags
#
# id :integer not null, primary key
# hash_tag :string not null
# deleted :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#

class HashTag < ActiveRecord::Base
has_many :bot_hash_tag_rels
has_many :bots, :through => :bot_hash_tag_rels, :dependent => :destroy

validates :hash_tag, presence: true

# 論理削除されていないレコードを全取得
def self.find_by_alive
HashTag.where(deleted: false)
Expand Down
13 changes: 13 additions & 0 deletions app/models/realtime_bot_hash_tag_tracking.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# == Schema Information
#
# Table name: realtime_bot_hash_tag_trackings
#
# id :integer not null, primary key
# bot_id :integer not null
# bot_type :integer
# content :text
# deleted :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#

class RealtimeBotHashTagTracking < ActiveRecord::Base
belongs_to :bots
end
18 changes: 18 additions & 0 deletions app/models/schedule.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# == Schema Information
#
# Table name: schedules
#
# id :integer not null, primary key
# user_id :integer not null
# bot_id :integer not null
# time :time not null
# weekday :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# by_bot_id (bot_id) UNIQUE
# by_user_id (user_id) UNIQUE
#

class Schedule < ActiveRecord::Base
belongs_to :bot
belongs_to :user
Expand Down
24 changes: 24 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# remember_created_at :datetime
# sign_in_count :integer default(0), not null
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string
# last_sign_in_ip :string
# created_at :datetime not null
# updated_at :datetime not null
# username :string
# provider :string
# uid :string
#
# Indexes
#
# index_users_on_username (username) UNIQUE
#

class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
Expand Down
30 changes: 23 additions & 7 deletions app/views/bot/bots/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
<div class="container">

<h2>BOTの編集</h2>



<%= form_for @bot, :url => {:action => 'update'} do |f| %>
<%= f.label :hash_tags %>
<p>BOTに関連するHashTagを選んでください。</p>
ハッシュタグを選んでください。<%= select_tag :hash_tags, options_from_collection_for_select(HashTag.all, :id, :hash_tag), :multiple => true %><div/>
曜日を選んでください。<%= select_tag :weekday, options_for_select({"月曜日" => "0", "火曜日" => "1", "水曜日" => "2", "木曜日" => "3", "金曜日" => "4", "土曜日" => "5", "日曜日" => "6"}) %><div/>
時間を選んでください。<%= select_tag :hour, options_for_select(0..23) %>:00
<br>
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>Q</th>
<th class="question">BOTに関連するHashTagを選んでください。</th>
<th>入力項目</th>
</tr>
<tr>
<td class="center">1</td>
<td>ハッシュタグを選んでください。</td>
<td><%= select_tag :hash_tags, options_from_collection_for_select(HashTag.all, :id, :hash_tag), :multiple => true, class: :"form-control" %></td>
</tr>
<tr>
<td class="center">2</td>
<td>曜日を選んでください。</td>
<td><%= select_tag :weekday, options_for_select({"月曜日" => "0", "火曜日" => "1", "水曜日" => "2", "木曜日" => "3", "金曜日" => "4", "土曜日" => "5", "日曜日" => "6"}), class: :"form-control" %></td>
</tr>
<tr>
<td class="center">3</td>
<td>時間を選んでください。</td>
<td><%= select_tag :hour, options_for_select(0..23), class: :"form-control time_select" %>:00</td>
</tr>
</table>
<%= f.submit "登録", class: 'btn btn-info' %>
<% end %>
</div>
6 changes: 3 additions & 3 deletions app/views/bot/bots/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
<tr>
<td><%= cnt+1 %></td>
<td><%= b.id %></td>
<td><%= b.twitter_name %></td>
<td class="center"><%= b.twitter_name %></td>
<td><%= b.twitter_id %></td>
<td>
<% b.hash_tags.each do |h| %>
<%= h.hash_tag %>
<% end %>
</td>
<td><%= button_to "編集", edit_bot_path(current_user.username, b.id), class: 'btn btn-warning', method: :get %></td>
<td><%= button_to "削除", destroy_bot_path(current_user.username, b.id), class: 'btn btn-danger', method: :delete %></td>
<td class="center"><%= button_to "編集", edit_bot_path(current_user.username, b.id), class: 'btn btn-warning', method: :get %></td>
<td class="center"><%= button_to "削除", destroy_bot_path(current_user.username, b.id), class: 'btn btn-danger', method: :delete %></td>
</tr>
<%end%>
<% end %>
Expand Down
Loading

0 comments on commit 05de3da

Please sign in to comment.