Added App.ControllerTabs feature.
This commit is contained in:
parent
b99fd95120
commit
e053a92425
10 changed files with 145 additions and 99 deletions
|
@ -188,8 +188,6 @@ class App.ControllerLevel2 extends App.Controller
|
|||
constructor: ->
|
||||
super
|
||||
|
||||
return if !@authenticate()
|
||||
|
||||
render: ->
|
||||
@log 'ttt', @target, @
|
||||
# set title
|
||||
|
@ -227,4 +225,22 @@ class App.ControllerLevel2 extends App.Controller
|
|||
@el.find('.tabbable').addClass('hide')
|
||||
@el.find('#' + target).removeClass('hide')
|
||||
# window.scrollTo(0,0)
|
||||
|
||||
|
||||
class App.ControllerTabs extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
render: ->
|
||||
@html App.view('generic/tabs')(
|
||||
tabs: @tabs,
|
||||
)
|
||||
@el.find('.nav-tabs li:first').addClass('active')
|
||||
|
||||
for tab in @tabs
|
||||
@el.find('.tab-content').append('<div class="tab-pane" id="' + tab.target + '">' + tab.target + '</div>')
|
||||
if tab.controller
|
||||
params = tab.params || {}
|
||||
params.el = @el.find( '#' + tab.target )
|
||||
new tab.controller( params )
|
||||
|
||||
@el.find('.tab-content .tab-pane:first').addClass('active')
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
$ = jQuery.sub()
|
||||
|
||||
class App.ChannelChat extends App.Controller
|
||||
events:
|
||||
'click [data-toggle="tabnav"]': 'toggle',
|
||||
|
||||
class App.ChannelChat extends App.ControllerTabs
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
# render page
|
||||
@render()
|
||||
@tabs = [
|
||||
{
|
||||
name: 'Settings',
|
||||
target: 'setting',
|
||||
controller: App.SettingsArea, params: { area: 'Chat::Base' },
|
||||
},
|
||||
]
|
||||
|
||||
render: ->
|
||||
|
||||
@html App.view('channel/chat')(
|
||||
head: 'some header'
|
||||
)
|
||||
|
||||
@render()
|
||||
|
|
|
@ -1,6 +1,99 @@
|
|||
$ = jQuery.sub()
|
||||
|
||||
class App.ChannelEmail extends App.Controller
|
||||
class App.ChannelEmail extends App.ControllerTabs
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
@tabs = [
|
||||
{
|
||||
name: 'Inbound',
|
||||
target: 'c-inbound',
|
||||
},
|
||||
{
|
||||
name: 'Outbound',
|
||||
target: 'c-outbound',
|
||||
},
|
||||
{
|
||||
name: 'Adresses',
|
||||
target: 'c-address',
|
||||
},
|
||||
{
|
||||
name: 'Filter',
|
||||
target: 'c-filter',
|
||||
},
|
||||
{
|
||||
name: 'Settings',
|
||||
target: 'c-setting',
|
||||
controller: App.SettingsArea, params: { area: 'Email::Base' },
|
||||
},
|
||||
]
|
||||
|
||||
# App.Channel.bind 'refresh change', @render
|
||||
# App.Channel.fetch()
|
||||
@render()
|
||||
|
||||
render2: =>
|
||||
settings = App.Setting.all()
|
||||
|
||||
html = $('<div></div>')
|
||||
for setting in settings
|
||||
if setting.area is @area
|
||||
item = new App.SettingsAreaItem( setting: setting )
|
||||
html.append( item.el )
|
||||
|
||||
@html html
|
||||
|
||||
|
||||
|
||||
class App.SettingsAreaItem2 extends App.Controller
|
||||
events:
|
||||
'submit form': 'update',
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
@render()
|
||||
|
||||
render: =>
|
||||
# defaults
|
||||
for item in @setting.options['form']
|
||||
if typeof @setting.state.value is 'object'
|
||||
item['default'] = @setting.state.value[item.name]
|
||||
else
|
||||
item['default'] = @setting.state.value
|
||||
|
||||
# form
|
||||
@configure_attributes = @setting.options['form']
|
||||
form = @formGen( model: { configure_attributes: @configure_attributes, className: '' }, autofocus: false )
|
||||
|
||||
# item
|
||||
@html App.view('settings/item')(
|
||||
setting: @setting,
|
||||
form: form,
|
||||
)
|
||||
|
||||
update: (e) =>
|
||||
e.preventDefault()
|
||||
params = @formParam(e.target)
|
||||
@log 'submit', @setting, params, e.target
|
||||
if typeof @setting.state.value is 'object'
|
||||
state = {
|
||||
value: params
|
||||
}
|
||||
else
|
||||
state = {
|
||||
value: params[@setting.name]
|
||||
}
|
||||
|
||||
@setting['state'] = state
|
||||
@setting.save(
|
||||
success: =>
|
||||
|
||||
# login check
|
||||
auth = new App.Auth
|
||||
auth.loginCheck()
|
||||
)
|
||||
|
||||
class App.ChannelEmail2 extends App.Controller
|
||||
events:
|
||||
'click [data-toggle="tabnav"]': 'toggle',
|
||||
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
$ = jQuery.sub()
|
||||
|
||||
class App.ChannelWeb extends App.Controller
|
||||
events:
|
||||
'click [data-toggle="tabnav"]': 'toggle',
|
||||
|
||||
class App.ChannelWeb extends App.ControllerTabs
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
# render page
|
||||
@render()
|
||||
@tabs = [
|
||||
{
|
||||
name: 'Settings',
|
||||
target: 'w-setting',
|
||||
controller: App.SettingsArea, params: { area: 'CustomerWeb::Base' },
|
||||
},
|
||||
]
|
||||
|
||||
render: ->
|
||||
|
||||
@html App.view('channel/web')(
|
||||
head: 'some header'
|
||||
)
|
||||
|
||||
@render()
|
||||
|
|
|
@ -19,6 +19,8 @@ class Index extends App.ControllerLevel2
|
|||
constructor: ->
|
||||
super
|
||||
|
||||
return if !@authenticate()
|
||||
|
||||
# render page
|
||||
@render()
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class Index extends App.ControllerLevel2
|
|||
constructor: ->
|
||||
super
|
||||
|
||||
return if !@authenticate()
|
||||
|
||||
# system
|
||||
if @type is 'system'
|
||||
@menu = [
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#" data-toggle="tab">Settings</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="1">
|
||||
<h2>Enable Chat</h2>
|
||||
<p>lala alals alals ala.</p>
|
||||
<hr/>
|
||||
<h2>Default Greetings</h2>
|
||||
<p>lala alals alals ala.</p>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
|
@ -1,11 +1,4 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#channel-inbound" data-toggle="tab">Inbound</a></li>
|
||||
<li><a href="#channel-outbound" data-toggle="tab">Outbound</a></li>
|
||||
<li><a href="#channel-filter" data-toggle="tab">Filter</a></li>
|
||||
<li><a href="#channel-settings" data-toggle="tab">Settings</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="channel-inbound">
|
||||
<div class="tab-pane active" id="channel-inbound">
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
|
@ -31,8 +24,9 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="tab-pane" id="channel-outbound">
|
||||
</div>
|
||||
<div class="tab-pane" id="channel-outbound">
|
||||
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Host</th>
|
||||
|
@ -76,29 +70,3 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane" id="channel-settings">
|
||||
<h2>Max. Email Size</h2>
|
||||
<p>lala alals alals ala.</p>
|
||||
<hr/>
|
||||
<h2>PostmasterFollowUpSearchIn</h2>
|
||||
<p>o References - Executes follow up checks on In-Reply-To or References headers for mails that don't have a ticket number in the subject.</p>
|
||||
<p>o Body - Executes follow up mail body checks in mails that don't have a ticket number in the subject.</p>
|
||||
<p>o Attachment - Executes follow up mail attachments checks in mails that don't have a ticket number in the subject.</p>
|
||||
<p>o Raw - Executes follow up plain/raw mail checks in mails that don't have a ticket number in the subject.</p>
|
||||
<hr/>
|
||||
<h2>FollowUpState</h2>
|
||||
<p>Defines the state of a ticket if it gets a follow-up.</p>
|
||||
<hr/>
|
||||
<h2>Blocks Emails</h2>
|
||||
<p>Blocks all the incoming emails that do not have a valid ticket number in subject with From: @example.com address.</p>
|
||||
<h2>Subject</h2>
|
||||
<p>Defines the subject for rejected emails.</p>
|
||||
<h2>Body</h2>
|
||||
<p>Defines the body for rejected emails.</p>
|
||||
<hr/>
|
||||
<h2>SendNoAutoResponseRegExp</h2>
|
||||
<p>If this regex matches, no message will be send by the autoresponder.</p>
|
||||
<p>(MAILER-DAEMON|postmaster|abuse)@.+?\..+?</p>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#" data-toggle="tab">Settings</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="1">
|
||||
<h2>Enable Ticket creation</h2>
|
||||
<p>lala alals alals ala.</p>
|
||||
<h3>Allowed attributes to set and default values</h3>
|
||||
<p>lala alals alals ala.</p>
|
||||
<hr/>
|
||||
<h2>Enable view and update of Tickets</h2>
|
||||
<p>lala alals alals ala.</p>
|
||||
<h3>Allowed attributes to see</h3>
|
||||
<p>lala alals alals ala.</p>
|
||||
<h3>Allowed attributes to update</h3>
|
||||
<p>lala alals alals ala.</p>
|
||||
<hr/>
|
||||
<h2>Enable view and update of Tickets</h2>
|
||||
<p>lala alals alals ala.</p>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
6
app/assets/javascripts/app/views/generic/tabs.jst.eco
Normal file
6
app/assets/javascripts/app/views/generic/tabs.jst.eco
Normal file
|
@ -0,0 +1,6 @@
|
|||
<ul class="nav nav-tabs">
|
||||
<% for tab in @tabs: %>
|
||||
<li><a href="#<%= tab.target %>" data-toggle="tab"><%= tab.name %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="tab-content"></div>
|
Loading…
Reference in a new issue