Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c0d69022
Commit
c0d69022
authored
May 08, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up Backbone model/view for alerts
parent
7e22278f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
0 deletions
+66
-0
cms/static/js/models/alert.js
+8
-0
cms/static/js/views/alert.js
+11
-0
cms/templates/base.html
+46
-0
cms/templates/widgets/header.html
+1
-0
No files found.
cms/static/js/models/alert.js
0 → 100644
View file @
c0d69022
CMS
.
Models
.
Alert
=
Backbone
.
Model
.
extend
({
defaults
:
{
"type"
:
null
,
"title"
:
null
,
"message"
:
null
,
"shown"
:
true
}
});
cms/static/js/views/alert.js
0 → 100644
View file @
c0d69022
CMS
.
Views
.
Alert
=
Backbone
.
View
.
extend
({
template
:
_
.
template
(
$
(
"#alert-tpl"
).
text
()),
initialize
:
function
()
{
this
.
setElement
(
$
(
"#page-alert"
));
this
.
listenTo
(
this
.
model
,
'change'
,
this
.
render
);
},
render
:
function
()
{
this
.
$el
.
html
(
this
.
template
(
this
.
model
.
attributes
));
return
this
;
}
});
cms/templates/base.html
View file @
c0d69022
...
@@ -51,6 +51,52 @@
...
@@ -51,6 +51,52 @@
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/CodeMirror/css.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/CodeMirror/css.js')}"
></script>
<script
type=
"text/javascript"
src=
"//www.youtube.com/player_api"
></script>
<script
type=
"text/javascript"
src=
"//www.youtube.com/player_api"
></script>
<!-- templates -->
<
%
text
>
<script
id=
"alert-tpl"
type=
"text/template"
>
<
div
class
=
"wrapper wrapper-alert <% if(obj.type) { %>wrapper-alert-<%= type %> <% }; if(obj.shown) { %>is-shown <% } else { %>is-hiding<% } %>"
>
<
div
class
=
"alert <%= type %> <% if(obj.actions) { %>has-actions <% } %>"
>
<%
var
iconText
=
{
"warning"
:
"⚠"
,
"confirmation"
:
"✓"
,
"error"
:
"⚠"
,
"announcement"
:
"📢"
,
"step-required"
:
""
}
%>
<
i
class
=
"ss-icon ss-symbolicons-block icon icon-<%= type %>"
><%=
iconText
[
type
]
%><
/i
>
<
div
class
=
"copy"
>
<
h2
class
=
"title title-3"
><%=
title
%><
/h2
>
<%
if
(
obj
.
message
)
{
%><
p
class
=
"message"
><%=
message
%><
/p><% } %
>
<
/div
>
<%
if
(
obj
.
actions
)
{
%>
<
nav
class
=
"nav-actions"
>
<
h3
class
=
"sr"
>
Alert
Actions
<
/h3
>
<
ul
>
<%
if
(
actions
.
primary
)
{
%>
<
li
class
=
"nav-item"
>
<
a
href
=
"#"
class
=
"button action-primary <%= actions.primary.cls %>"
><%=
actions
.
primary
.
text
%><
/a
>
<
/li
>
<%
}
%>
<%
if
(
actions
.
secondary
)
{
_
.
each
(
actions
.
secondary
,
function
(
secondary
)
{
%>
<
li
class
=
"nav-item"
>
<
a
href
=
"#"
class
=
"button action-secondary <%= secondary.cls %>"
><%=
secondary
.
text
%><
/a
>
<
/li
>
<%
});
}
%>
<
/ul
>
<
/nav
>
<%
}
%>
<%
if
(
obj
.
close
)
{
%>
<
a
href
=
"#"
rel
=
"view"
class
=
"action action-alert-close"
>
<
i
class
=
"ss-icon ss-symbolicons-block icon icon-close"
>&
#
x2421
;
<
/i
>
<
span
class
=
"label"
>
close
alert
<
/span
>
<
/a
>
<%
}
%>
<
/div
>
<
/div
>
</script>
</
%
text>
<script
src=
"${static.url('js/models/alert.js')}"
></script>
<script
src=
"${static.url('js/views/alert.js')}"
></script>
<!-- view -->
<!-- view -->
<div
class=
"wrapper wrapper-view"
>
<div
class=
"wrapper wrapper-view"
>
<
%
include
file=
"widgets/header.html"
/>
<
%
include
file=
"widgets/header.html"
/>
...
...
cms/templates/widgets/header.html
View file @
c0d69022
...
@@ -116,3 +116,4 @@
...
@@ -116,3 +116,4 @@
</div>
</div>
</header>
</header>
</div>
</div>
<div
id=
"page-alert"
></div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment