Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
Added jQuery-ui and some better chart analysis stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
tylergannon committed Jun 13, 2012
1 parent 154de38 commit ca7ee38
Show file tree
Hide file tree
Showing 24 changed files with 738 additions and 100 deletions.
69 changes: 69 additions & 0 deletions app/assets/javascripts/jquery-ui-1.8.21.custom.min.js

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions app/assets/javascripts/people.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,28 @@
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$ ->
$('.star').each (idx, el) ->
$el = $(el)
$el.qtip
content:
text: $el.find('.star_auspices')

$('.star_auspices').each (idx, el) ->
$(el).dialog
autoOpen: false
# $('#chart_analysis_tabs').dialog
# width: '600px',
# height: '800px'
$('.chart_palace').each (idx, el) ->
$(el).accordion
collapsible: true,
active: false
$('.chart_palace_star').each (idx, el) ->
$(el).accordion
collapsible: true,
clearStyle: true,
active: false
$('#chart_analysis_tabs').tabs()
$('.chart').tabs()
# $('.chart_analysis_accordion').accordion
# collapsible: true
# $('.star').each (idx, el) ->
# $el = $(el)
# star = $el.data('star')
# $el.click ->
# $('#' + star + '_auspices').dialog('open')
#
11 changes: 9 additions & 2 deletions app/assets/stylesheets/charts.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ $radius: 12px;
height: 20px;
}

h3 {
height: 14px;
.center {
h3 {
height: 14px;
padding: 10px;
margin: 0;
}
}

width: ($palace-width + $border-width)*4;
Expand Down Expand Up @@ -171,5 +175,8 @@ $radius: 12px;
right: 0;
margin-right: 8px;
}
table.elemental_scores {
font-size: 12pt;
}

}
26 changes: 25 additions & 1 deletion app/assets/stylesheets/people/people.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

//.ui-dialog-titlebar {
// height: 7px;
//
// .ui-dialog-titlebar-close {
// display: block;
// position: absolute;
// top: 0;
// right: 0;
// }
//}

.chart > .ui-tabs-nav {
position: absolute;
top: -45px;
left: 544px;
// line-height: 10px;
}

#chart_analysis_tabs {
// .ui-tabs-nav {
// line-height: 0;
// }
}

.star_auspices {
display: none;
// display: none;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
565 changes: 565 additions & 0 deletions app/assets/stylesheets/pepper-grinder/jquery-ui-1.8.21.custom.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CommentsController < InheritedResources::Base
respond_to :html, :js
belongs_to :element, :branch, :star, :pillar, :star_palace, :polymorphic => true
belongs_to :element, :branch, :star, :pillar, :star_palace, :chart_star, :polymorphic => true
before_filter :parent
before_filter :load_comment, :only => [:show, :edit, :update, :destroy]
helper_method :comments
Expand Down
3 changes: 3 additions & 0 deletions app/models/palace.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
class Palace < ActiveRecord::Base
def friendly_id
name.underscore.gsub(/\//, '-dash-')
end
def self.reseed
destroy_all
NAMES.each_with_index do |name, index|
Expand Down
3 changes: 1 addition & 2 deletions app/views/people/_star.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.star{class: "rank#{star.rank} #{star_class}", data: {star: star.friendly_id}}
= "#{star.pinyin} / #{star.english}"
.star_auspices
.star_auspices{id: "#{star.friendly_id}_auspices"}
- star_comments = star.my_comments(current_member)
.star_comments
%h4= star.pinyin
Expand All @@ -17,4 +17,3 @@
.comment!= RedCloth.new(comment.comments).to_html
- else
No comments for this star in this palace.

128 changes: 40 additions & 88 deletions app/views/people/show.html.haml
Original file line number Diff line number Diff line change
@@ -1,92 +1,44 @@

.chart
- (1..12).map{|t| Branch[t]}.each do |branch|
- palace = @chart.palaces[branch]
.palace{class: branch.animal}
%h3= "#{palace.ordinal}. #{palace.name}"
.major_stars
- if palace.major_stars.empty?
= render partial: 'star', collection: borrowed_stars(palace), locals: {star_class: 'borrowed_star', chart_palace: palace}
- else
= render partial: 'star', collection: major_stars(palace), locals: {star_class: 'major_star', chart_palace: palace}
.minor_stars
= render partial: 'star', collection: minor_stars(palace), locals: {star_class: 'minor_star', chart_palace: palace}
- if @person
%span.small_limits= palace.small_limits(@chart, @person) + " (#{palace.great_limit(@chart, @person)})"
%span.palace_location #{palace.location.char} #{palace.location.pinyin} #{palace.location.animal}
.center
%h2= @name
.data= (@person ? @person.dob : @chart.solar_date).strftime '%Y %B %d, %I %p'
.data= "#{numeric(@chart.lunar_month)} month / #{numeric(@chart.day_of_month)} day".html_safe
.data= "Inner Element: #{@chart.inner_element.titleize}"
%table
%tr
- for name, pillar in {'Year' => @chart.year, 'Month' => @chart.month, 'Day' => @chart.day, 'Hour' => @chart.hour}
%td
%h3= name
.something= pillar.chinese
.something= pillar.pinyin
.something= pillar.name
.title Elemental Score:
%table.elemental_scores
%tr
%td Wood: #{@chart.wood_score}
%td Fire: #{@chart.fire_score}
%td Earth: #{@chart.earth_score}
%td Metal: #{@chart.metal_score}
%td Water: #{@chart.water_score}

.chart_analysis
.analyzing_four_pillars
%h3 Analyzing the Four Pillars:
%ol
%li
%p
The Earthly Branch of the Year is #{@chart.year.branch.animal.titleize}.
= render :partial => 'show_comments', :object => @chart.year.branch

%li
%p
The Heavenly Stem of the Year is #{@chart.year.stem.name}. How does this relate to the Earthly Branch?
%ul.list_stuff
%li
The native element of #{@chart.year.branch.animal.titleize} is #{@chart.year.native_element.name.titleize}.
#{@chart.year.native_element.related_to(Element.by_name(@chart.year.stem.element))}.
= render :partial => 'show_comments', :object => @chart.year.stem._element
= render :partial => 'show_comments', :object => @chart.year
%li
%p
The Earthly Branch of the Hour is #{@chart.hour.branch.animal.titleize}.
= render :partial => 'show_comments', :object => @chart.hour.branch
%li
%p
The Heavenly Stem of the Hour is #{@chart.hour.stem.name}. How does this relate to the Earthly Branch?
%ul.list_stuff
%li
The native element of #{@chart.hour.branch.animal.titleize} is #{@chart.hour.native_element.name.titleize}.
#{@chart.hour.native_element.related_to(Element.by_name(@chart.hour.stem.element))}.
= render :partial => 'show_comments', :object => @chart.hour.stem._element
= render :partial => 'show_comments', :object => @chart.hour
%li
%p Now synthesize a picture of the character based on these four steps, remembering the precedence of the first ones over the later ones.


.inner_to_outer
%h3
Inner Element (#{@chart.inner_element.titleize}) and Year Stem (#{@chart.year.stem.element.titleize}):
#{Element.by_name(@chart.year.stem.element).related_to(Element.by_name(@chart.inner_element))}
.stars
- @chart.palaces.each do |chart_palace|
.chart_palace
%h3= chart_palace.palace.name
- chart_palace.stars.each do |star|
.chart_palace_star
%h4= star.pinyin
- star.my_comments(current_member).each do |comment|
.comment!= RedCloth.new(comment.comments).to_html
- star.star_palace(chart_palace.palace).my_comments(current_member).each do |comment|
.comment!= RedCloth.new(comment.comments).to_html

%ul
%li= link_to 'Chart', '#chart'
%li= link_to 'Analysis', '#chart_analysis_tabs'
#chart
- (1..12).map{|t| Branch[t]}.each do |branch|
- palace = @chart.palaces[branch]
.palace{class: branch.animal}
%h3= "#{palace.ordinal}. #{palace.name}"
.major_stars
- if palace.major_stars.empty?
= render partial: 'star', collection: borrowed_stars(palace), locals: {star_class: 'borrowed_star', chart_palace: palace}
- else
= render partial: 'star', collection: major_stars(palace), locals: {star_class: 'major_star', chart_palace: palace}
.minor_stars
= render partial: 'star', collection: minor_stars(palace), locals: {star_class: 'minor_star', chart_palace: palace}
- if @person
%span.small_limits= palace.small_limits(@chart, @person) + " (#{palace.great_limit(@chart, @person)})"
%span.palace_location #{palace.location.char} #{palace.location.pinyin} #{palace.location.animal}
.center
%h2= @name
.data= (@person ? @person.dob : @chart.solar_date).strftime '%Y %B %d, %I %p'
.data= "#{numeric(@chart.lunar_month)} month / #{numeric(@chart.day_of_month)} day".html_safe
.data= "Inner Element: #{@chart.inner_element.titleize}"
%table
%tr
- for name, pillar in {'Year' => @chart.year, 'Month' => @chart.month, 'Day' => @chart.day, 'Hour' => @chart.hour}
%td
%h3= name
.something= pillar.chinese
.something= pillar.pinyin
.something= pillar.name
.title Elemental Score:
%table.elemental_scores
%tr
%td Wood: #{@chart.wood_score}
%td Fire: #{@chart.fire_score}
%td Earth: #{@chart.earth_score}
%td Metal: #{@chart.metal_score}
%td Water: #{@chart.water_score}
= render partial: 'chart_analysis_tabs'


- if @person
Expand Down

0 comments on commit ca7ee38

Please sign in to comment.