-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
179 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,6 @@ $(function() { | |
}); | ||
|
||
$('.datepicker').datepicker($.datepicker.regional['ru']); | ||
|
||
$('.has-tooltip').tooltip(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,3 +109,5 @@ h2.inactive { | |
display: inline; | ||
} | ||
} | ||
|
||
.no-margin { margin: 0px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the update_histories controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class UpdateHistoriesController < ApplicationController | ||
load_and_authorize_resource | ||
|
||
def index | ||
@link = Link.find(params[:link_id]) | ||
@history = @link.update_histories.order("created_at DESC") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module UpdateHistoriesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
class Placement < ActiveRecord::Base | ||
has_many :links, :dependent => :destroy | ||
has_many :update_histories | ||
|
||
validates :name, :presence => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
class Status < ActiveRecord::Base | ||
has_many :links, :dependent => :destroy | ||
has_many :update_histories | ||
|
||
validates :name, :presence => true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class UpdateHistory < ActiveRecord::Base | ||
attr_accessible :inactive, :keyword, :link_id, :name, :our_site_id, :page_rank, :placement_id, :status_id, :url | ||
|
||
belongs_to :link | ||
belongs_to :placement | ||
belongs_to :status | ||
belongs_to :our_site | ||
|
||
validates :link_id, presence: true | ||
|
||
delegate :name, to: :status, prefix: true, allow_nil: true | ||
delegate :name, to: :placement, prefix: true, allow_nil: true | ||
delegate :name, to: :our_site, prefix: true, allow_nil: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
%h1= title t(:history_for, :link => @link.url) | ||
|
||
- if @history.present? | ||
%table.table.table-striped | ||
%thead | ||
%tr | ||
%th | ||
%span.has-tooltip{title: @link.url} | ||
= UpdateHistory.human_attribute_name(:url) | ||
%th | ||
%span.has-tooltip{title: @link.page_rank} | ||
= UpdateHistory.human_attribute_name(:page_rank) | ||
%th | ||
%span.has-tooltip{title: @link.name} | ||
= UpdateHistory.human_attribute_name(:name) | ||
%th | ||
%span.has-tooltip{title: @link.placement_name} | ||
= UpdateHistory.human_attribute_name(:placement) | ||
%th | ||
%span.has-tooltip{title: @link.keyword} | ||
= UpdateHistory.human_attribute_name(:keyword) | ||
%th | ||
%span.has-tooltip{title: @link.status_name} | ||
= UpdateHistory.human_attribute_name(:status) | ||
%th | ||
%span.has-tooltip{title: @link.our_site_name} | ||
= UpdateHistory.human_attribute_name(:our_site) | ||
%th | ||
%span.has-tooltip{title: (@link.inactive? ? t(:inactive_yes) : t(:inactive_no))} | ||
= UpdateHistory.human_attribute_name(:inactive) | ||
%tbody | ||
- @history.each do |history| | ||
%tr | ||
%td= history.url | ||
%td= history.page_rank | ||
%td= history.name | ||
%td= history.placement_name | ||
%td= history.keyword | ||
%td= history.status_name | ||
%td= history.our_site_name | ||
%td= history.inactive? ? t(:inactive_yes) : t(:inactive_no) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class CreateUpdateHistories < ActiveRecord::Migration | ||
def change | ||
create_table :update_histories do |t| | ||
t.integer :link_id | ||
t.string :url | ||
t.string :name | ||
t.integer :page_rank | ||
t.string :keyword | ||
t.integer :status_id | ||
t.integer :placement_id | ||
t.integer :our_site_id | ||
t.boolean :inactive | ||
|
||
t.timestamps | ||
end | ||
add_index :update_histories, :link_id | ||
add_index :update_histories, :status_id | ||
add_index :update_histories, :placement_id | ||
add_index :update_histories, :our_site_id | ||
add_index :update_histories, :inactive | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters