/
common.coffee
110 lines (81 loc) · 2.72 KB
/
common.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
class DrupalApp extends JView
constructor:->
super
@listenWindowResize()
@dashboardTabs = new KDTabView
hideHandleCloseIcons : yes
hideHandleContainer : yes
cssClass : "wp-installer-tabs"
@consoleToggle = new KDToggleButton
states : [
"Console",(callback)->
@setClass "toggle"
split.resizePanel 250, 0
callback null
"Console ×",(callback)->
@unsetClass "toggle"
split.resizePanel 0, 1
callback null
]
@buttonGroup = new KDButtonGroupView
buttons :
"Dashboard" :
cssClass : "clean-gray toggle"
callback : => @dashboardTabs.showPaneByIndex 0
"Install a new Drupal" :
cssClass : "clean-gray"
callback : => @dashboardTabs.showPaneByIndex 1
@dashboardTabs.on "PaneDidShow", (pane)=>
if pane.name is "dashboard"
@buttonGroup.buttonReceivedClick @buttonGroup.buttons.Dashboard
else
@buttonGroup.buttonReceivedClick @buttonGroup.buttons["Install a new Drupal"]
viewAppended:->
super
@dashboardTabs.addPane dashboard = new DashboardPane
cssClass : "dashboard"
name : "dashboard"
@dashboardTabs.addPane installPane = new InstallPane
name : "install"
@dashboardTabs.showPane dashboard
installPane.on "WordPressInstalled", (formData)->
{domain, path} = formData
dashboard.putNewItem formData
KD.utils.wait 200, ->
# timed out because we give some time to server to cleanup the temp files until it filetree refreshes
tc.refreshFolder tc.nodes["/Users/#{nickname}/Sites/#{domain}/website"], ->
KD.utils.wait 200, ->
tc.selectNode tc.nodes["/Users/#{nickname}/Sites/#{domain}/website/#{path}"]
@_windowDidResize()
_windowDidResize:->
@dashboardTabs.setHeight @getHeight() - @$('>header').height()
pistachio:->
"""
<header>
<figure></figure>
<article>
<h3>Drupal Installer</h3>
<p>This application installs Drupal instances and gives you a dashboard of what is already installed</p>
</article>
<section>
{{> @buttonGroup}}
{{> @consoleToggle}}
</section>
</header>
{{> @dashboardTabs}}
"""
class DrupalSplit extends KDSplitView
constructor:(options, data)->
@output = new KDScrollView
tagName : "pre"
cssClass : "terminal-screen"
@drupalApp = new DrupalApp
options.views = [ @drupalApp, @output ]
super options, data
viewAppended:->
super
@panels[1].setClass "terminal-tab"
class Pane extends KDTabPaneView
viewAppended:->
@setTemplate @pistachio()
@template.update()