Skip to content
This repository was archived by the owner on Mar 19, 2020. It is now read-only.

Commit 31efe42

Browse files
author
Yuma Soga
committed
Upgrade Index
1 parent 07145c8 commit 31efe42

File tree

18 files changed

+780
-77
lines changed

18 files changed

+780
-77
lines changed

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ gem 'travis'
2727

2828
gem 'haml-rails'
2929

30-
gem 'kramdown', '~> 1.1.0'
30+
# gem 'kramdown', '~> 1.1.0'
3131

3232
gem 'font-awesome-rails'
3333

@@ -43,6 +43,8 @@ gem 'bootstrap', '~> 4.1.1'
4343

4444
gem 'simple_form'
4545

46+
gem 'redcarpet'
47+
4648
group :development, :test do
4749
gem 'sqlite3'
4850
gem 'byebug'

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ GEM
131131
thor (>= 0.14, < 2.0)
132132
json (1.8.6)
133133
jwt (1.5.6)
134-
kramdown (1.1.0)
135134
launchy (2.4.3)
136135
addressable (~> 2.3)
137136
listen (3.1.5)
@@ -218,6 +217,7 @@ GEM
218217
rb-inotify (0.9.10)
219218
ffi (>= 0.5.0, < 2)
220219
rdoc (4.3.0)
220+
redcarpet (3.4.0)
221221
rest-client (2.0.2)
222222
http-cookie (>= 1.0.2, < 2.0)
223223
mime-types (>= 1.16, < 4.0)
@@ -327,12 +327,12 @@ DEPENDENCIES
327327
haml-rails
328328
jbuilder (~> 2.0)
329329
jquery-rails
330-
kramdown (~> 1.1.0)
331330
listen
332331
omniauth-slack
333332
pg
334333
rails (= 5.2.0)
335334
rails-controller-testing
335+
redcarpet
336336
rest-client
337337
rspec-rails
338338
sass-rails (~> 5.0.5)
Loading

app/assets/stylesheets/application.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
@import "font-awesome";
1717

1818
@import "bootstrap-creative/creative";
19-
19+
@import "pages";
20+
@import "posts";
2021
@import "bootstrap";
2122

2223
//

app/assets/stylesheets/pages.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,8 @@
126126
// }
127127
// }
128128
// }
129+
#page-content {
130+
.page-title {
131+
border-bottom: 0.3rem dotted $primary;
132+
}
133+
}

app/controllers/pages_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ def show
1111
unless @page.exists?
1212
render :action => "not_found_404", :status => 404
1313
end
14-
@content = Kramdown::Document.new(@page.content).to_html
14+
@content = MarkdownHelper.md_to_html @page.source
1515
@url = request.url
1616
end
17-
17+
1818
def not_found_404
1919
end
20-
end
20+
end

app/helpers/markdown_helper.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module MarkdownHelper
2+
def md_to_html(md_text)
3+
options = {
4+
hard_wrap: true,
5+
space_after_headers: true
6+
}
7+
8+
extensions = {
9+
autolink: true,
10+
no_intra_emphasis: true,
11+
fenced_code_blocks: true
12+
}
13+
unless @markdown
14+
renderer = Redcarpet::Render::HTML.new(options)
15+
@markdown = Redcarpet::Markdown.new(renderer, extensions)
16+
end
17+
18+
@markdown.render(md_text).html_safe
19+
end
20+
end

app/models/page.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ def exists?
2929
end
3030

3131
def description
32-
@desc ||= exists? ? self.content.lines.reject{|l| l =~ /^(\n|<)/ }.second.delete('<br>').strip : ''
32+
@desc ||= exists? ? self.source.lines.reject{|l| l =~ /^(\n|<)/ }.second.delete('<br>').strip : ''
3333
end
3434

3535
def title
36-
@title ||= exists? ? self.content.lines.first[2..-1].strip.gsub('<br>', '') : ''
36+
@title ||= exists? ? self.source.lines.first[2..-1].strip.gsub('<br>', '') : ''
3737
end
3838

39-
def content
40-
@content ||= exists? ? File.read(path) : ''
39+
def source
40+
@source ||= exists? ? File.read(path) : ''
4141
end
42-
end
42+
end

app/views/layouts/pages.html.haml

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
%html
33
%head
44
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5-
/ Page styles
6-
%link{:href => "https://fonts.googleapis.com/icon?family=Material+Icons", :rel => "stylesheet"}/
7-
%link{:href => "https://code.getmdl.io/1.3.0/material.indigo-pink.min.css", :rel => "stylesheet"}/
8-
%script{:defer => "defer", :src => "https://code.getmdl.io/1.3.0/material.min.js"}
95
%title
106
= yield(:title)
117
| CoderDojo Konan Okayama
@@ -27,57 +23,50 @@
2723
%meta{:content => "1974108302904511", :property => "fb:app_id"}/
2824
%meta{:coderdojo => "1881439892127060", :property => "fb:pages"}/
2925
%meta{:content => "CoderDojo 岡山 岡南", :name => "author"}/
30-
%body
31-
.mdl-layout.mdl-js-layout.pages-layout
32-
%header.mdl-layout__header.mdl-layout__header--scroll.pages-layout__header
33-
.mdl-layout__header-row
34-
/ Title
35-
%span.mdl-layout-title
36-
%a{:href => root_path}
37-
%img{:alt => "CoderDojo Konan Okayama", :src => "#{asset_path "coderdojo-konan-header-logo.png"}"}/
38-
/ Add spacer, to align navigation to the right
39-
.mdl-layout-spacer
40-
/ Navigation
41-
%nav.mdl-navigation
42-
%a.mdl-navigation__link{:href => "#{@first_link[:url]}"}= @first_link[:text]
43-
%a.mdl-navigation__link{:href => "#{@second_link[:url]}"}= @second_link[:text]
44-
%a.mdl-navigation__link{:href => "#{@third_link[:url]}"}= @third_link[:text]
45-
%a.mdl-navigation__link{:href => "#{@fourth_link[:url]}"}= @fourth_link[:text]
46-
.mdl-layout__drawer
47-
%span.mdl-layout-title CoderDojo Konan Okayama Official Site
48-
%nav.mdl-navigation
49-
%a.mdl-navigation__link{:href => "#{@first_link[:url]}"}= @first_link[:text]
50-
%a.mdl-navigation__link{:href => "#{@second_link[:url]}"}= @second_link[:text]
51-
%a.mdl-navigation__link{:href => "#{@third_link[:url]}"}= @third_link[:text]
52-
%a.mdl-navigation__link{:href => "#{@fourth_link[:url]}"}= @fourth_link[:text]
53-
%main.mdl-layout__content
54-
%article
55-
%section#pages-section
56-
.pages-section-card.mdl-card.mdl-shadow--2dp
57-
.mdl-card__title
58-
%h1.mdl-card__title-text= yield(:title)
59-
.pages-contents.mdl-card__supporting-text
60-
.twitter-share-button-style
61-
%a.twitter-share-button{"data-hashtags" => "CoderDojo岡南", "data-related" => "CoderDojo_Konan,CoderDojoJapan", "data-show-count" => "false", "data-text" => "#{yield(:title) + " - CoderDojo 岡山 岡南 公式HP"}", "data-url" => "#{yield(:url)}", "data-via" => "CoderDojo_Konan", :href => "https://twitter.com/share?ref_src=twsrc%5Etfw"} Tweet
62-
.fb-share-button.fb-share-button-style{"data-href" => "#{request.url}", "data-layout" => "button_count", "data-mobile-iframe" => "true", "data-size" => "small"}
63-
%a.fb-xfbml-parse-ignore{:href => "https://www.facebook.com/sharer/sharer.php?u=#{request.url}=sdkpreparse", :target => "_blank"} シェア
64-
= yield
65-
%footer.mdl-mini-footer
66-
.mdl-mini-footer__left-section
67-
.mdl-logo
68-
CoderDojo Konan Okayama Official Site
69-
%ul.mdl-mini-footer__link-list
70-
%li Copyright © 2018 CoderDojo Konan Okayama
71-
.mdl-mini-footer__right-section
72-
%button.mdl-mini-footer__social-btn
73-
%a{:href => "https://twitter.com/coderdojo_konan", :target => "_blank", :title => "Twitter"}
74-
%i.fa.fa-twitter
75-
%button.mdl-mini-footer__social-btn
76-
%a{:href => "http://facebook.com/Coderdojo.Konan/", :target => "_blank", :title => "Facebook"}
77-
%i.fa.fa-facebook
78-
%button.mdl-mini-footer__social-btn
79-
%a{:href => "https://www.instagram.com/coderdojo_konan/", :target => "_blank", :title => "Instagram"}
80-
%i.fa.fa-instagram
81-
%button.mdl-mini-footer__social-btn
82-
%a{:href => "https://github.com/CoderDojo-Konan-Okayama", :target => "_blank", :title => "Github"}
83-
%i.fa.fa-github
26+
%link{:href => "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800", :rel => "stylesheet", :type => "text/css"}/
27+
%link{:href => "https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic", :rel => "stylesheet", :type => "text/css"}/
28+
%body#page-top
29+
/ Navigation
30+
%nav#mainNav.navbar.navbar-expand-lg.navbar-light.fixed-top
31+
.container-fluid
32+
%a.navbar-brand.js-scroll-trigger{:href => "#{root_url}#page-top"}
33+
%button.navbar-toggler.navbar-toggler-right{"aria-controls" => "navbarResponsive", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#navbarResponsive", "data-toggle" => "collapse", :type => "button"}
34+
%span.navbar-toggler-icon
35+
#navbarResponsive.collapse.navbar-collapse
36+
%ul.navbar-nav.ml-auto
37+
%li.nav-item
38+
%a.nav-link.js-scroll-trigger{:href => "#about"} About
39+
%li.nav-item
40+
%a.nav-link.js-scroll-trigger{:href => "#services"} Services
41+
%li.nav-item
42+
%a.nav-link.js-scroll-trigger{:href => "#portfolio"} Portfolio
43+
%li.nav-item
44+
%a.nav-link.js-scroll-trigger{:href => "#contact"} Contact
45+
%article
46+
%section#page-content
47+
.container
48+
.row
49+
.col-lg-12.mx-auto.my-3
50+
= yield
51+
52+
%footer.bg-dark
53+
.footer-connect
54+
.container
55+
.row
56+
.col-lg-12.mx-auto.my-3.text-center.text-white
57+
.footer-social
58+
%h5 Social Links
59+
.footer-social-icons
60+
%a.mx-1{ target: "_blank" , href: "https://twitter.com/coderdojo_konan", title: "Twitter" }
61+
= fa_icon "twitter 2x"
62+
%a.mx-1{ target: "_blank", href: "http://facebook.com/Coderdojo.Konan/", title: "Facebook" }
63+
= fa_icon "facebook 2x"
64+
%a.mx-1{ target: "_blank", href: "https://www.instagram.com/coderdojo_konan/", title: "Instagram" }
65+
= fa_icon "instagram 2x"
66+
%a.mx-1{ target: "_blank", href: "https://github.com/CoderDojo-Konan-Okayama", title: "Github" }
67+
= fa_icon "github 2x"
68+
%a.mx-1{ target: "_blank", href: "https://www.youtube.com/channel/UCRN6euxI9l10q6I-gVewVcw", title: "YouTube" }
69+
= fa_icon "youtube 2x"
70+
.row
71+
.col-lg-12.col-lg-12.mx-auto.my-3.text-center.text-white
72+
%p Copyright © 2018 CoderDojo Konan Okayama

app/views/layouts/staticpages.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/ Navigation
2828
%nav#mainNav.navbar.navbar-expand-lg.navbar-light.fixed-top
2929
.container-fluid
30-
%a.navbar-brand.js-scroll-trigger{:href => "#page-top"}
30+
%a.navbar-brand.js-scroll-trigger{:href => "#{root_url}#page-top"}
3131
%button.navbar-toggler.navbar-toggler-right{"aria-controls" => "navbarResponsive", "aria-expanded" => "false", "aria-label" => "Toggle navigation", "data-target" => "#navbarResponsive", "data-toggle" => "collapse", :type => "button"}
3232
%span.navbar-toggler-icon
3333
#navbarResponsive.collapse.navbar-collapse

app/views/pages/index.html.haml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
- provide(:title, @title)
22
- provide(:desc, 'このサイトのページ一覧です。特別なページなどは含まれていない場合もあります。')
33
- provide(:url, request.url)
4-
.docs-list
5-
%ul
4+
5+
%h1.page-title.m-3.p-2= @title
6+
7+
.docs-list.m-3.p-2
8+
%ul.list-group
69
- @pages.each do |page|
7-
%li= link_to page.title, page.url
10+
%li.list-group-item= link_to page.title, page.url

app/views/pages/show.html.haml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
- provide(:title, @page.title)
22
- provide(:desc, @page.description)
33
- provide(:url, request.url)
4-
= raw @content
4+
5+
.headings.page-title.m-3.p-2
6+
%h1= @page.title
7+
%p= @page.description
8+
9+
.content.m-3.p-2
10+
= raw @content

config/application.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ module Workspace
1010
class Application < Rails::Application
1111
# Initialize configuration defaults for originally generated Rails version.
1212
config.load_defaults 5.1
13-
14-
# config.time_zone = 'Tokyo'
1513

1614
# Settings in config/environments/* take precedence over those specified here.
1715
# Application configuration can go into files in config/initializers

0 commit comments

Comments
 (0)