Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Gulp css build integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kmmbvnr committed Jun 9, 2016
1 parent d0e1050 commit e2bf113
Show file tree
Hide file tree
Showing 83 changed files with 6,814 additions and 15,675 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2016"]
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ db*.sqlite3
deploy
build/
dist/
node_modules/
django_material.egg-info/
tests/visual/screenshots_test/
tests/visual/screenshots_test/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prefix=.npm-modules
2 changes: 1 addition & 1 deletion demo/examples/accounting/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

class Accounting(ModuleMixin, AppConfig):
name = "demo.examples.accounting"
icon = '<i class="mdi-action-payment"></i>'
icon = '<i class="material-icons">payment</i>'
2 changes: 1 addition & 1 deletion demo/examples/sales/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

class Sales(ModuleMixin, AppConfig):
name = "demo.examples.sales"
icon = '<i class="mdi-communication-quick-contacts-dialer"></i>'
icon = '<i class="material-icons">call_end</i>'
54 changes: 27 additions & 27 deletions demo/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class LoginForm(forms.Form):

template = Template("""
{% form %}
{% part form.email prefix %}<i class="mdi-communication-email prefix"></i>{% endpart %}
{% part form.password prefix %}<i class="mdi-action-lock prefix"></i>{% endpart %}
{% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
{% part form.password prefix %}<i class="material-icons prefix">lock</i>{% endpart %}
{% attr form.keep_logged 'group' class append %}right-align{% endattr %}
{% endform %}
""")
Expand Down Expand Up @@ -180,9 +180,9 @@ class RegistrationForm(forms.Form):

template = Template("""
{% form %}
{% part form.username prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.email prefix %}<i class="mdi-communication-email prefix"></i>{% endpart %}
{% part form.password prefix %}<i class="mdi-action-lock-open prefix"></i>{% endpart %}
{% part form.username prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
{% part form.password prefix %}<i class="material-icons prefix">lock_open</i>{% endpart %}
{% endform %}
""")

Expand All @@ -203,10 +203,10 @@ class ContactForm(forms.Form):

template = Template("""
{% form %}
{% part form.name prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.email prefix %}<i class="mdi-communication-email prefix"></i>{% endpart %}
{% part form.subject prefix %}<i class="mdi-action-announcement prefix"></i>{% endpart %}
{% part form.message prefix %}<i class="mdi-communication-message prefix"></i>{% endpart %}
{% part form.name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
{% part form.subject prefix %}<i class="material-icons prefix">announcement</i>{% endpart %}
{% part form.message prefix %}<i class="material-icons prefix">message</i>{% endpart %}
{% attr form.send_copy 'group' class append %}right-align{% endattr %}
{% endform %}
""")
Expand Down Expand Up @@ -241,10 +241,10 @@ class OrderForm(forms.Form):

template = Template("""
{% form %}
{% part form.name prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.company prefix %}<i class="mdi-communication-business prefix"></i>{% endpart %}
{% part form.email prefix %}<i class="mdi-communication-email prefix"></i>{% endpart %}
{% part form.phone prefix %}<i class="mdi-communication-call prefix"></i>{% endpart %}
{% part form.name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.company prefix %}<i class="material-icons prefix">business</i>{% endpart %}
{% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
{% part form.phone prefix %}<i class="material-icons prefix">call</i>{% endpart %}
{% endform %}
""")

Expand Down Expand Up @@ -290,10 +290,10 @@ class CheckoutForm(forms.Form):

template = Template("""
{% form %}
{% part form.first_name prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.last_name prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.email prefix %}<i class="mdi-communication-email prefix"></i>{% endpart %}
{% part form.phone prefix %}<i class="mdi-communication-call prefix"></i>{% endpart %}
{% part form.first_name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.last_name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
{% part form.phone prefix %}<i class="material-icons prefix">call</i>{% endpart %}
{% part form.card_type label %}{% endpart %}
{% endform %}
""")
Expand Down Expand Up @@ -323,10 +323,10 @@ class CommentForm(forms.Form):

template = Template("""
{% form %}
{% part form.name prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.email prefix %}<i class="mdi-communication-email prefix"></i>{% endpart %}
{% part form.website prefix %}<i class="mdi-action-wallet-travel prefix"></i>{% endpart %}
{% part form.comment prefix %}<i class="mdi-communication-chat prefix"></i>{% endpart %}
{% part form.name prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.email prefix %}<i class="material-icons prefix">email</i>{% endpart %}
{% part form.website prefix %}<i class="material-icons prefix">card_travel</i>{% endpart %}
{% part form.comment prefix %}<i class="material-icons prefix">chat</i>{% endpart %}
{% endform %}
""")

Expand Down Expand Up @@ -552,15 +552,15 @@ class EmergencyContractForm(forms.Form):
Fieldset('Procedural Questions', 'procedural_questions'),
Fieldset('Clinical Predictores of Cardiovascular Risk', 'cardiovascular_risks'),
Fieldset('Clinical Predictors of sleep Apnia Risk', 'apnia_risks'),
Fieldset('Emergence Numbers', 'emergency_contacts'))
Fieldset('Emergency Contacts', 'emergency_contacts'))

template = Template("""
{% form %}
{% part form.registration_date prefix %}<i class="mdi-editor-insert-invitation prefix"></i>{% endpart %}
{% part form.date_of_last_appointment prefix %}<i class="mdi-editor-insert-invitation prefix"></i>{% endpart %}
{% part form.primary_care_physician prefix %}<i class="mdi-action-face-unlock prefix"></i>{% endpart %}
{% part form.home_phone prefix %}<i class="mdi-communication-call prefix"></i>{% endpart %}
{% part form.work_phone prefix %}<i class="mdi-communication-call prefix"></i>{% endpart %}
{% part form.registration_date prefix %}<i class="material-icons prefix">insert_invitation</i>{% endpart %}
{% part form.date_of_last_appointment prefix %}<i class="material-icons prefix">insert_invitation</i>{% endpart %}
{% part form.primary_care_physician prefix %}<i class="material-icons prefix">face</i>{% endpart %}
{% part form.home_phone prefix %}<i class="material-icons prefix">call</i>{% endpart %}
{% part form.work_phone prefix %}<i class="material-icons prefix">call</i>{% endpart %}
{% part form.procedural_questions label %}{% endpart %}
{% part form.cardiovascular_risks label %}{% endpart %}
{% part form.cardiovascular_risks columns %}2{% endpart %}
Expand Down
5 changes: 3 additions & 2 deletions demo/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends "admin/base.html" %}

{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
{% block branding %}<i class="mdi-action-settings-applications" style="font-size:80px"></i>{% endblock %}
{% block branding %}<i class="material-icons" style="font-size:80px">settings_applications</i>{% endblock %}

{% block nav-global %}{% endblock %}

{% block extrajs %}
Expand All @@ -14,5 +15,5 @@


{% block back_link %}
<li class="no-padding"><a class="collapsible-header no-pjax" href="/accounting/"><i class="mdi-navigation-arrow-back"></i> Back to website</a></li>
<li class="no-padding"><a class="collapsible-header no-pjax" href="/accounting/"><i class="material-icons">arrow_back</i> Back to website</a></li>
{% endblock %}
55 changes: 55 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import autoprefixer from 'autoprefixer';
import gulp from 'gulp';
import postcss from 'gulp-postcss';
import sass from 'gulp-sass';

gulp.task('material-icons.font', () => {
return gulp.src('./node_modules/material-design-icons/iconfont/*')
.pipe(gulp.dest('./material/static/material/fonts/material-design-icons/'));
});


gulp.task('roboto.font', () => {
return gulp.src('./node_modules/materialize-css/fonts/roboto/*')
.pipe(gulp.dest('./material/static/material/fonts/roboto/'));
});



gulp.task('materialize.js', () => {
return gulp.src('./node_modules/materialize-css/dist/js/materialize.js')
.pipe(gulp.dest('./material/static/material/js/'));
});


gulp.task('materialize.css', () => {
return gulp.src('./material/static/material/sass/*.scss')
.pipe(sass({
includePaths: './node_modules/'
}).on(
'error', sass.logError
))
.pipe(postcss([
autoprefixer({
browsers: [
'Chrome >= 50',
'Firefox >= 46',
'Explorer >= 11',
'Safari >= 9',
'ChromeAndroid >= 50',
'FirefoxAndroid >= 46',
]
})
]))
.pipe(gulp.dest(
'./material/static/material/css/'
));
});


gulp.task("default", [
"materialize.js",
"materialize.css",
"roboto.font",
"material-icons.font"
]);
2 changes: 1 addition & 1 deletion material/admin/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MaterialAdminConfig(ModuleMixin, AppConfig):
name = 'material.admin'
label = "material_admin"

icon = '<i class="mdi mdi-action-settings-applications"></i>'
icon = '<i class="material-icons">settings_application</i>'
verbose_name = _("Administration")
order = 1000

Expand Down
4 changes: 2 additions & 2 deletions material/admin/static/admin/js/SelectFilter2.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ window.SelectFilter = {
selector_chooser.className = 'selector-chooser col s12';
var add_link = quickElement('a', quickElement('li', selector_chooser), '', 'title', gettext('Choose'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link');
add_link.className = 'selector-add btn-floating btn-flat green lighten-2';
quickElement('i', add_link).className = 'mdi-navigation-chevron-right';
quickElement('i', add_link, 'chevron_right').className = 'material-icons';
var remove_link = quickElement('a', quickElement('li', selector_chooser), '', 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link');
quickElement('i', remove_link).className = 'mdi-navigation-chevron-left';
quickElement('i', remove_link, 'chevron_left').className = 'material-icons';
remove_link.className = 'selector-remove btn-floating btn-flat green lighten-2';

// <div class="selector-chosen">
Expand Down
27 changes: 15 additions & 12 deletions material/admin/static/material/admin/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ th {
display: table-cell;
}

nav img[class*="mdi-"] {
height: 35px;
}

nav ul a:hover {
background-color: rgba(0, 0, 0, 0);
}
Expand Down Expand Up @@ -125,16 +121,22 @@ ul.side-nav.fixed.module-menu li a {
overflow: hidden;
}

ul.side-nav.module-menu .collapsible-body li.active, .side-nav.fixed .collapsible-body li.active {
background: #4CAF50;
ul.side-nav.module-menu a.collapsible-header {
padding-left: 15px;
padding-right: 15px;
}

ul.side-nav.module-menu li a {
margin-left: 0;
ul.side-nav.module-menu .collapsible-header i.material-icons {
font-size: 1.6rem;
margin-right: 1rem;
}

ul.side-nav.module-menu .collapsible-body li .collapsible-body a {
margin-left: 45px;
.side-nav.fixed .collapsible-body .collapsible-body li a {
padding-left: 4rem;
}

ul.side-nav.module-menu .collapsible-body li.active, .side-nav.fixed .collapsible-body li.active {
background: #4CAF50;
}

ul.side-nav.module-menu li.active>a>span.badge {
Expand Down Expand Up @@ -391,10 +393,11 @@ ul.side-nav.module-menu li.active>a>span.badge {
white-space: nowrap;
}

.fixedHeader-floating thead .zmdi,
.results thead .zmdi {
.fixedHeader-floating thead i.material-icons,
.results thead i.material-icons {
line-height: 15px;
margin-left:-19px;
font-size: 15px;
}

.results table.collapsed td,
Expand Down
4 changes: 2 additions & 2 deletions material/admin/templates/admin/auth/user/change_password.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{% csrf_token %}
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% form %}
{% part form.password1 prefix %}<i class="mdi-action-lock prefix"></i>{% endpart %}
{% part form.password2 prefix %}<i class="mdi-action-lock prefix"></i>{% endpart %}
{% part form.password1 prefix %}<i class="material-icons prefix">lock</i>{% endpart %}
{% part form.password2 prefix %}<i class="material-icons prefix">lock</i>{% endpart %}
{% endform %}
<div class="card-action right-align">
<button type="submit" class="btn btn-primary">{% trans 'Change password' %}</button>
Expand Down
8 changes: 4 additions & 4 deletions material/admin/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
<nav id="header" class="nav-top green">
<div class="nav-wrapper">
<a href="/" class="page-title hide-on-med-and-down">{% block brand-logo %}{% trans 'Administration' %}{% endblock %}</a>
<a href="#" data-activates="nav-mobile" class="button-collapse full"><i class="mdi-navigation-menu"></i></a>
<a href="#" data-activates="nav-mobile" class="button-collapse full"><i class="material-icons">menu</i></a>

<ul class="right">
{% if user.is_authenticated %}
<li><a class="dropdown-button constrain_width" href="#!" data-activates="user-menu">{{ user.get_full_name|default:user.username }}<i class="mdi-navigation-arrow-drop-down right"></i></a></li>
<li><a class="dropdown-button constrain_width" href="#!" data-activates="user-menu">{{ user.get_full_name|default:user.username }}<i class="material-icons right">arrow_drop_down</i></a></li>
{% endif %}
</ul>
</div>
Expand All @@ -56,14 +56,14 @@
</li>

{% block breadcrumbs_left %}
{% block back_link %}<li class="no-padding"><a class="collapsible-header no-pjax" href="/"><i class="mdi-navigation-arrow-back"></i>{% trans 'Back to website' %}</a></li>{% endblock %}
{% block back_link %}<li class="no-padding"><a class="collapsible-header no-pjax" href="/"><i class="material-icons">arrow_back</i>{% trans 'Back to website' %}</a></li>{% endblock %}
<li class="no-padding active">
<div class="collapsible-body" style="display:block">
<ul class="collapsible" data-collapsible="accordion">
{% get_app_list request as app_list %}
{% for app in app_list %}
<li class="header{% if app.active %} active{% endif %}">
<a class="collapsible-header{% if app.active %} active{% endif %}"><i class="mdi-action-settings-applications"></i> {{ app.name|truncatechars:23 }}</a>
<a class="collapsible-header{% if app.active %} active{% endif %}"><i class="material-icons">settings_applications</i> {{ app.name|truncatechars:23 }}</a>
<div class="collapsible-body" {% if app.active %}style="display:block"{% endif %}>
<ul>
{% for model in app.models %}
Expand Down
2 changes: 1 addition & 1 deletion material/admin/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}

{% block branding %}<i class="mdi-action-settings-applications" style="font-size:80px"></i>{% endblock %}
{% block branding %}<i class="material-icons" style="font-size:80px">settings_applications</i>{% endblock %}

{% block nav-global %}{% endblock %}
2 changes: 1 addition & 1 deletion material/admin/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
{% url cl.opts|admin_urlname:'add' as add_url %}
<div class="fixed-action-btn">
<a class="btn-floating btn-large waves-effect waves-light red z-depth-2" href="{% add_preserved_filters add_url is_popup to_field %}">
<i class="large mdi-content-add"></i>
<i class="large material-icons">add</i>
</a>
</div>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions material/admin/templates/admin/change_list_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
{% if header.sort_priority == 0 %}
<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>
{% elif header.ascending %}
<a href="{{ header.url_primary }}" title="{% trans "Toggle sorting" %}"><i class="zmdi zmdi-long-arrow-up zmdi-hc-fw"></i> {{ header.text|capfirst }}</a>
<a href="{{ header.url_primary }}" title="{% trans "Toggle sorting" %}"><i class="material-icons">arrow_upward</i> {{ header.text|capfirst }}</a>
{% else %}
<a href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}"><i class="zmdi zmdi-long-arrow-down zmdi-hc-fw"></i> {{ header.text|capfirst }}</a>
<a href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}"><i class="material-icons">arrow_downward</i> {{ header.text|capfirst }}</a>
{% endif %}
{% else %}
<span>{{ header.text|capfirst }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{% endfor %}
<input type="hidden" name="action" value="delete_selected" />
<input type="hidden" name="post" value="yes" />
<button type="submit" class="btn btn-primary"><i class="mdi-action-done"></i> {% trans "Yes, I'm sure" %}</button>
<button type="submit" class="btn btn-primary"><i class="material-icons">done</i> {% trans "Yes, I'm sure" %}</button>
</div>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion material/admin/templates/admin/includes/material_css.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load admin_static %}
<link href="{% static 'material/fonts/material-design-icons/material-icons.css' %}" rel="stylesheet">
<link href="{% static 'material/css/materialize.css' %}" rel="stylesheet">
<link href="{% static 'material/css/material-design-iconic-font.css' %}" rel="stylesheet">
<link href="{% static 'material/css/jquery.datetimepicker.css' %}" rel="stylesheet">
<link href="{% static 'material/css/responsive.dataTables.css' %}" rel="stylesheet">
<link href="{% static 'material/css/fixedHeader.dataTables.css' %}" rel="stylesheet">
Expand Down
4 changes: 2 additions & 2 deletions material/admin/templates/admin/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
{% if 'username' in form.fields %}
{% form %}
{% part form.username prefix %}<i class="mdi-action-account-box prefix"></i>{% endpart %}
{% part form.password prefix %}<i class="mdi-action-lock prefix"></i>{% endpart %}
{% part form.username prefix %}<i class="material-icons prefix">account_box</i>{% endpart %}
{% part form.password prefix %}<i class="material-icons prefix">lock</i>{% endpart %}
{% endform %}
{% else %}
{% form %}{% endform %}
Expand Down
Loading

0 comments on commit e2bf113

Please sign in to comment.