Skip to content

Commit

Permalink
added WYSIWYG
Browse files Browse the repository at this point in the history
  • Loading branch information
enterteg committed Mar 24, 2016
1 parent 3938010 commit 30c8cbf
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ gem 'paperclip', '~> 4.3', '>= 4.3.6'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'puma'

gem 'tinymce-rails'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.2)
tinymce-rails (4.3.8)
railties (>= 3.1.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
Expand Down Expand Up @@ -170,6 +172,7 @@ DEPENDENCIES
sdoc (~> 0.4.0)
spring
sqlite3
tinymce-rails
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require tinymce
//= require_tree .
14 changes: 12 additions & 2 deletions app/assets/javascripts/posts.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ add_pin = (x, y) ->


$ ->
tinyMCE.init {
selector: 'textarea#post_desc',
content_css : '<%= asset_path 'public.sass'%>'
}

$('#map_form').hide()
if( $('#post_category_id option:selected').val() == '1' )
$('#map_form').fadeIn()
Expand All @@ -54,6 +59,11 @@ $ ->

$(document).on 'page:load', ->
$('#map_form').hide()
tinyMCE.init {
selector: 'textarea#post_desc',
content_css : '<%= asset_path 'public.sass'%>'
}



$(document).on 'page:receive', ->
tinymce.remove()
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
*= require_tree .
*= require_self
*/

29 changes: 15 additions & 14 deletions app/assets/stylesheets/posts.sass
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
@import 'mixins'


//--------- form styles
#new_post
max-width: 600px
max-width: 700px
margin: 50px auto
.submit
text-align: center
input
&[type="submit"]
margin: 0 auto
padding: 10px 20px
background: rgba(200,50,200,0.35)
outline: none
font-size: 1.3rem
background: white
color: rgba(150,50,150,0.75)
outline: 1px solid rgba(150,50,150,0.35)
font-size: 1.6rem
font-family: 'Roboto'
border: none
color: white
cursor: pointer
font-weight: bold
+transition(0.2s ease all)
&:hover
color: white
background: rgba(200,50,200,0.5)
.input
margin: 20px 0px
display: flex
flex-direction: column
#mceu_28
#post_desc_ifr
body#tinymce
font-size: 30px
.upload
float: left
text-align: center
width: 90px
line-height: 35px
Expand All @@ -52,9 +55,7 @@
input
flex-grow: 1
padding: 10px
&[type="submit"]
padding: 20px
color: red

&[type="file"]
display: block
width: 90px
Expand All @@ -63,23 +64,23 @@
top: 0px
left: 0px
position: absolute
background-color: red
cursor: pointer

label
font-size: 1.2rem
margin: 10px 0px
textarea
height: 400px
resize: vertical
padding: 20px
padding: 10px
input, textarea, select
font-family: 'Roboto'
font-size: 1rem
&:focus
outline: 2px solid rgba(250,0,250,0.1)





//--------- map styles
Expand Down
49 changes: 25 additions & 24 deletions app/assets/stylesheets/public.sass
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ body
padding: 0
font-family: 'Roboto', sans-serif
font-size: 16px
body#tinymce
padding: 10px
padding-top: 0px
font-family: 'Roboto', sans-serif
font-weight: 100
.container
max-width: 1000px
margin: 0 auto
Expand All @@ -24,7 +29,7 @@ body
float: left
margin: 0px 15px
ul
color: rgba(250,20,250,1)
color: rgba(100,20,150,0.5)
padding: 0px
margin: 0px
line-height: $top_menu_height
Expand All @@ -45,8 +50,17 @@ body
.admin
float: right
line-height: $top_menu_height


.logout
background: none
color: rgba(0,0,0,0.7)
padding: 5px
outline: none
font-weight: 100
&:hover
color: black
border-bottom: 2px solid rgba(200,50,200,0.5)
.stats


.social
float: right
Expand Down Expand Up @@ -124,27 +138,14 @@ section


.button
letter-spacing: 0.5px
border-radius: 7px
margin-left: 5px
padding: 9px 15px
text-decoration: none
color: #333
+transition(0.3s ease all)
background-color: rgba(150,0,150,0.2)
margin-left: 5px
padding: 8px 18px
color: rgba(150,50,150,0.8)
font-size: 1.1rem
cursor: pointer
+transition(0.2s ease all)
outline: 1px solid rgba(200,50,200,0.2)
&:hover
color: white
background-color: rgba(140,0,150,0.3)
&.logout
color: black
outline: none
font-weight: 100
background-color: transparent
padding: 0px
font-size: 0.9e
padding: 5px 10px
border-bottom: 1px solid white
border-top: 1px solid white
&:hover
border-bottom: 1px solid #ccc
border-top: 1px solid #ccc
background: rgba(200,50,200,0.4)
4 changes: 0 additions & 4 deletions app/views/partials/_map.html.haml

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/posts/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= f.text_field :title
.input
= f.label :desc, 'Content'
= f.text_area :desc
= f.text_area :desc, class: "tinymce"
.input
= label_tag :photos, 'Photos'
.upload
Expand Down
1 change: 0 additions & 1 deletion app/views/public/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
%br/
%br/
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
=render 'partials/map'
23 changes: 23 additions & 0 deletions config/locales/en.bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.

en:
breadcrumbs:
application:
root: "Index"
pages:
pages: "Pages"
helpers:
actions: "Actions"
links:
back: "Back"
cancel: "Cancel"
confirm: "Are you sure?"
destroy: "Delete"
new: "New"
edit: "Edit"
titles:
edit: "Edit %{model}"
save: "Save %{model}"
new: "New %{model}"
delete: "Delete %{model}"

0 comments on commit 30c8cbf

Please sign in to comment.