Skip to content

Commit

Permalink
fix settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Jul 21, 2015
1 parent c850cc1 commit 171fc72
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 50 deletions.
16 changes: 1 addition & 15 deletions client/routes/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,7 @@ FlowRouter.route '/settings/:group?',
@register 'admin-settings', Meteor.subscribe('admin-settings')

action: ->
FlowLayout.render 'main', {}

track = Tracker.autorun ->
if not FlowRouter.subsReady()
return

track?.stop()

if not Meteor.user()? or Meteor.user().admin isnt true
FlowRouter.go('home')
return

FlowLayout.render 'main', {center: 'settings'}
KonchatNotification.getDesktopPermission()

FlowLayout.render 'main', {center: 'settings'}

FlowRouter.route '/history/private',
name: 'privateHistory'
Expand Down
4 changes: 3 additions & 1 deletion client/views/settings/settings.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Template.settings.helpers
isAdmin: ->
return Meteor.user().admin is true
groups: ->
return Settings.find({type: 'group'}).fetch()
group: ->
Expand Down Expand Up @@ -32,4 +34,4 @@ Template.settings.events
Template.settings.onRendered ->
console.log 'room.onRendered' if window.rocketDebug
Session.set 'flexOpened', true
FlexTab.check()
FlexTab.check()
74 changes: 40 additions & 34 deletions client/views/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,49 @@ <h2>
</div>
</head>
<div class="content">
<h3>{{label}}</h3>
<div class="rocket-form">
<fieldset>
<legend>
<!-- <h3>This is another section</h3>
<p>This is a configuration text. With configuration info</p> -->
</legend>
{{#each settings}}
<div class="input-line double-col">
<label>{{label}}</label>
<div>
<input type="text" name="input-name" value="{{value}}" />
{{#unless isAdmin}}
<p>You are not authorized to view this page.</p>
{{else}}
<h3>{{label}}</h3>
<div class="rocket-form">
<fieldset>
<legend>
<!-- <h3>This is another section</h3>
<p>This is a configuration text. With configuration info</p> -->
</legend>
{{#each settings}}
<div class="input-line double-col">
<label>{{label}}</label>
<div>
<input type="text" name="input-name" value="{{value}}" />
</div>
</div>
</div>
{{/each}}
</fieldset>
</div>
{{/each}}
</fieldset>
</div>
{{/unless}}
</div>
</section>
<section class="flex-tab">
<div class="control">
<button class="more"><span class="arrow {{arrowPosition}}"></span></button>
<div class="search-form">
<div class="input-line search">
<input type="text" class="search" placeholder={{_ "Search_settings"}} />
<i class="icon-plus"></i>
{{#if isAdmin}}
<section class="flex-tab">
<div class="control">
<button class="more"><span class="arrow {{arrowPosition}}"></span></button>
<div class="search-form">
<div class="input-line search">
<input type="text" class="search" placeholder={{_ "Search_settings"}} />
<i class="icon-plus"></i>
</div>
</div>
</div>
</div>
<div class="content">
<ul class='list cf_ lines'>
{{#each groups}}
<li>
<a href="{{pathFor 'settings' group=_id}}">{{_ i18nLabel}}</a>
</li>
{{/each}}
</ul>
</div>
</section>
<div class="content">
<ul class='list cf_ lines'>
{{#each groups}}
<li>
<a href="{{pathFor 'settings' group=_id}}">{{_ i18nLabel}}</a>
</li>
{{/each}}
</ul>
</div>
</section>
{{/if}}
</template>

0 comments on commit 171fc72

Please sign in to comment.