Skip to content

Commit

Permalink
Networks in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
soyjavi committed Apr 17, 2015
1 parent 8e5fb87 commit c1525b9
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 38 deletions.
1 change: 0 additions & 1 deletion api/settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = (server) ->
response.json settings.parse()
response.json settings.parse()


server.put "/api/settings", (request, response) ->
Hope.shield([ ->
Session request, response, redirect = false, owner = true
Expand Down
9 changes: 5 additions & 4 deletions assets/80cents.admin.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions assets/80cents.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/80cents.theme.default.css

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion common/models/settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Settings = new Schema
google_analytics : type: String
# -- Payments
payments : type: Object
# -- Networks
networks : type: Object
# -- Cached Elements
collections : type: Array
pages : type: Array
Expand Down Expand Up @@ -62,7 +64,9 @@ Settings.statics.cache = ->
promise.done null, @cached
else
@search().then (error, value) =>
promise.done error, @cached = value?.parse() or {}
value = value?.parse() or {}
value.networks = (type: type, url: url for type, url of value.networks when url isnt "")
promise.done error, @cached = value
promise

# -- Instance methods ----------------------------------------------------------
Expand All @@ -79,6 +83,7 @@ Settings.methods.parse = ->
account_mail : @account_mail
customer_mail : @customer_mail
address : @address
networks : @networks
timezone : @timezone
currency : @currency
currency_shortcut : _currencyShortcut @currency
Expand Down
10 changes: 10 additions & 0 deletions source/admin/app.scaffold.settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ __.scaffold.form_settings =
"Molecule.Address": id: "address", title: "Legal Name of Business"
,
"Atom.Label": style: "anchor"
,
"Molecule.Div": children: [
"Atom.Heading": size: "h2", value: "Social Networks"
,
"Atom.Text": value: "Set you social networks links."
]
,
"Molecule.Networks": id: "networks"
,
"Atom.Label": style: "anchor"
,
"Molecule.Div": children: [
"Atom.Heading": size: "h2", value: "Standards & formats"
Expand Down
1 change: 1 addition & 0 deletions source/admin/molecule/form.group.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Atoms.Molecule.FormGroup extends Atoms.Molecule.Div
@images?.value []
@search?.clean()
@address?.clean()
@networks?.clean()
@shipping?.clean()
@billing?.clean()
@el.find("[data-atom-button].cancel")[if @entity then "removeAttr" else "attr"] "disabled", true
Expand Down
1 change: 1 addition & 0 deletions source/admin/molecule/form.group.settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ class Atoms.Molecule.Settings extends Atoms.Molecule.FormGroup
@trigger "progress", 100
form.value @entity for form in @children when form.constructor.name is "Form"
@address.value @entity.address
@networks.value @entity.networks
30 changes: 30 additions & 0 deletions source/admin/molecule/form.networks.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use strict"

class Atoms.Molecule.Networks extends Atoms.Molecule.Form

@extends : true

@default:
children: [
"Atom.Label": style: "half", value: "Facebook"
,
"Atom.Label": style: "half", value: "Twitter"
,
"Atom.Input": style: "half", name: "facebook"
,
"Atom.Input": style: "half", name: "twitter"
,
"Atom.Label": style: "half", value: "Pinterest"
,
"Atom.Label": style: "half", value: "Instagram"
,
"Atom.Input": style: "half", name: "pinterest"
,
"Atom.Input": style: "half", name: "instagram"
]

value: (values) ->
values = super values
result = {}
result[@attributes.id] = values
result
38 changes: 19 additions & 19 deletions source/store/style/flexo/flexo.page.footer.styl
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
body
> footer
padding : (2 * SPACE) 0 SPACE 0
background-color : darken(BACKGROUND, 1%)
> *
margin : SPACE 0
padding : (2 * SPACE) 0
background-color : lighten(THEME, 80%)
> nav
&.networks
border-top : solid 1px BOX
padding : SPACE 0 (SPACE / 2) 0
&:not(.networks)
margin-bottom : SPACE
> a
margin : 0 (SPACE / 2)
&:not(.icon)
font-size : FONT_SIZE_SMALL
font-weight : FONT_WEIGHT_BOLD
&.icon
font-size : FONT_SIZE_BIG
> small
padding-top : (2 * SPACE)
border-top : solid 1px BOX
text-transform : Uppercase
a
margin : 0 (SPACE / 2)
&:not(.icon)
font-size : FONT_SIZE_SMALL
font-weight : FONT_WEIGHT_BOLDgi
> nav.networks, > small
opacity : 0.75

@media screen and (max-device-width: 480px)
body > footer
padding : SPACE = (SPACE / 2) 0
> *
margin : 0
padding : SPACE 0 (SPACE / 2) 0
a:not(.icon)
font-size : FONT_SIZE_TINY
a.icon, > small
opacity : 0.5
font-size : (0.85 * FONT_SIZE_TINY)
> small
padding-top : (SPACE / 2)
border-top : none
font-size : (0.75 * FONT_SIZE_TINY)
5 changes: 3 additions & 2 deletions source/store/style/flexo/flexo.page.header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ body
&[data-shopio=session]
> a
&:not([data-shopio=cart])
background-color : COLOR
color : WHITE
padding-left : SPACE = (SPACE / 1.75)
padding-right : SPACE
margin-right : 0
color : WHITE
background-color : COLOR
abbr
display : none
.icon
Expand Down
13 changes: 5 additions & 8 deletions www/mustache/store.footer.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
<nav>
{{#settings.pages}}<a href="/{{url_handle}}">{{title}}</a>{{/settings.pages}}
</nav>
<nav class="networks">
{{#settings.networks}}
<a href="{{url}}" class="icon {{type}}"></a>
{{/settings.networks}}
</nav>
<small>
COPYRIGHT © 2015 {{settings.address.contact}}. ALL RIGHTS RESERVED.
</small>
{{!
<nav class="networks">
<a href="/" class="icon twitter"></a>
<a href="/" class="icon facebook"></a>
<a href="/" class="icon instagram"></a>
<a href="/" class="icon pinterest"></a>
</nav>
}}
</footer>

0 comments on commit c1525b9

Please sign in to comment.