Skip to content

Commit

Permalink
Merge branch 'release-1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
abidibo committed May 14, 2020
2 parents bf829a7 + d3a4a16 commit cb4b2d4
Show file tree
Hide file tree
Showing 26 changed files with 8,753 additions and 157 deletions.
110 changes: 56 additions & 54 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion baton/static/baton/app/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015", "stage-0"]
"presets": ["@babel/preset-env"]
}
4,938 changes: 4,938 additions & 0 deletions baton/static/baton/app/dist/18df003f90a7f1313b98b23384ec4f1b.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3,570 changes: 3,570 additions & 0 deletions baton/static/baton/app/dist/3c45c98f6f6c1b009c082510d0255ef4.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
57 changes: 56 additions & 1 deletion baton/static/baton/app/dist/baton.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion baton/static/baton/app/dist/baton.min.js.map

Large diffs are not rendered by default.

Binary file not shown.
38 changes: 22 additions & 16 deletions baton/static/baton/app/package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
{
"name": "baton",
"version": "1.5.8",
"version": "1.6.0",
"description": "Django Baton App",
"main": "index.js",
"scripts": {
"compile": "./node_modules/webpack/bin/webpack.js -p",
"dev": "webpack-dev-server --host 0.0.0.0 --progress --colors --config ./webpack.config.babel.js",
"compile": "./node_modules/webpack/bin/webpack.js --env.NODE_ENV=production",
"dev": "webpack-dev-server --env.NODE_ENV=development --host 0.0.0.0 --progress --colors --config ./webpack.config.babel.js",
"lint": "./node_modules/eslint/bin/eslint.js ."
},
"author": "abidibo",
"license": "ISC",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/register": "^7.9.0",
"@fortawesome/fontawesome-free": "^5.8.1",
"autoprefixer": "^9.2.1",
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.18.0",
"babel-preset-stage-0": "^6.16.0",
"babel-cli": "^6.26.0",
"babel-loader": "^8.1.0",
"babel-register": "^6.18.0",
"bootstrap": "^4.3.1",
"css-loader": "^0.26.1",
"file-loader": "^0.10.0",
"bootstrap": "^4.5.0",
"css-loader": "^3.5.3",
"file-loader": "^6.0.0",
"jquery": "^3.1.1",
"js-event-dispatcher": "^0.1.0",
"loader": "^2.1.1",
"mini-svg-data-uri": "^1.2.3",
"node-sass": "^4.5.0",
"popper.js": "^1.14.4",
"popper.js": "^1.16.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^4.1.1",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^1.14.0"
"url-loader": "^4.1.0",
"webpack": "^4.43.0"
},
"devDependencies": {
"babel-eslint": "^7.1.1",
Expand All @@ -39,6 +43,8 @@
"eslint-plugin-flow-vars": "^0.5.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"webpack-dev-server": "^1.16.2"
"webpack-bundle-analyzer": "^3.7.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
}
}
18 changes: 12 additions & 6 deletions baton/static/baton/app/src/core/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@ let Menu = {
let mainUl = $('<ul/>', { 'class': 'depth-0' }).appendTo(self.menu)
data.forEach((voice, index) => {
let active = false
if (voice.url) {
let pathRexp = new RegExp(voice.url)
active = pathRexp.test(location.pathname)
if (voice.type === 'free') {
active = (location.pathname === voice.url)
} else {
if (voice.url) {
let pathRexp = new RegExp(voice.url)
active = pathRexp.test(location.pathname)
}
}
let li = $('<li />', { 'class': 'top-level ' + voice.type + (active ? ' active' : '') })
let li = $('<li />', {
'class': 'top-level ' + voice.type + (voice.defaultOpen ? ' default-open' : '') + (active ? ' active' : '')
})
let a = $('<' + (voice.url ? 'a' : 'span') + ' />', {
href: voice.url || '#'
}).text(voice.label).appendTo(li)
Expand Down Expand Up @@ -102,8 +108,8 @@ let Menu = {
let p = $(this).parent()
let depth0 = $('.depth-0')
let depth1 = p.children('ul')
if (p.hasClass('open')) {
p.removeClass('open')
if ((p.hasClass('open')) || (p.hasClass('default-open'))) {
p.removeClass('open default-open')
depth1.children('.nav-back').remove()
depth0.css('overflow', 'auto')
} else {
Expand Down
3 changes: 2 additions & 1 deletion baton/static/baton/app/src/styles/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
}


.open {
.open,
.default-open {
@include media-breakpoint-up(lg) {
.has-children {
&::after {
Expand Down
150 changes: 80 additions & 70 deletions baton/static/baton/app/webpack.config.babel.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,89 @@
import webpack from 'webpack'
import path from 'path'
import svgToMiniDataURI from 'mini-svg-data-uri'
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

const webpackConfig = {
// this is needed to resolve imports from the js root
resolve: {
// always import from root (src and node_modules)
root: [
'src',
'node_modules'
],
extensions: ['', '.js']
},
// let the loaders be found when parsing resources in all paths
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
// library entry point
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/dist',
filename: 'baton.min.js',
},
// this for creating source maps
devtool: 'source-map'
}

webpackConfig.plugins = [
new webpack.optimize.UglifyJsPlugin({minimize: true}),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery'
})
]
module.exports = env => {
const webpackConfig = {
mode: 'production',
// this is needed to resolve imports from the js root
resolve: {
// always import from root (src and node_modules)
modules: [
path.join(__dirname, 'src'),
'node_modules'
],
extensions: ['.js']
},
// library entry point
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/dist',
filename: 'baton.min.js',
},
// this for creating source maps
devtool: 'source-map'
}

webpackConfig.module = {
loaders: []
}
webpackConfig.plugins = [
new BundleAnalyzerPlugin(),
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery',
jquery: 'jquery'
})
]

// js loaders
webpackConfig.module.loaders.push({
test: /\.(js)$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0']
webpackConfig.module = {
rules: []
}
})

// css loaders
webpackConfig.module.loaders.push({
test: /\.scss/,
loader: 'style!css!postcss!sass'
}, {
test: /\.sass/,
loader: 'style!css!postcss!sass'
})
// js loaders
webpackConfig.module.rules.push({
test: /\.(js)$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['@babel/preset-env']
}
})

// File loaders
webpackConfig.module.loaders.push(
{
test: /\.svg(\?.*)?$/,
loader: 'url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=image/svg+xml'
},
/*
{
test: /\.(png|jpg)$/,
loader: 'url?limit=8192'
},
*/
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/,
loader: 'url?limit=100000&name=[name].[ext]'
}
)
// css loaders
webpackConfig.module.rules.push({
test: /\.scss/,
loader: 'style-loader!css-loader!postcss-loader!sass-loader'
}, {
test: /\.sass/,
loader: 'style-loader!css-loader!postcss-loader!sass-loader'
})

export default webpackConfig
// File loaders
webpackConfig.module.rules.push(
{
test: /\.(eot|woff|woff2|ttf|png|jpe?g|gif)(\?\S*)?$/,
use: {
loader: 'url-loader',
options: {
limit: env.NODE_ENV === 'development' ? 5e6 : 1e4,
publicPath: '/static/baton/app/dist/',
}
}
},
{
test: /\.svg$/i,
use: [
{
loader: 'url-loader',
options: {
limit: env.NODE_ENV === 'development' ? 5e6 : 1e4,
publicPath: '/static/baton/app/dist/',
generator: (content) => svgToMiniDataURI(content.toString()),
},
},
],
},
)

return webpackConfig
}
3 changes: 3 additions & 0 deletions baton/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def get_title_voice(self, item):
'type': 'title',
'label': item.get('label', ''),
'icon': item.get('icon', None),
'defaultOpen': item.get('default_open', False),
'children': children,
}
return None
Expand All @@ -97,6 +98,7 @@ def get_free_voice(self, item):
'label': item.get('label', ''),
'icon': item.get('icon', None),
'url': item.get('url', None),
'defaultOpen': item.get('default_open', False),
'children': children,
}
return None
Expand Down Expand Up @@ -127,6 +129,7 @@ def get_app_voice(self, item):
'type': 'app',
'label': item.get('label', ''),
'icon': item.get('icon', None),
'defaultOpen': item.get('default_open', False),
'children': children
}
return None
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
# built documents.
#
# The short X.Y version.
version = u'1.5.8'
version = u'1.6.0'
# The full version, including alpha/beta/rc tags.
release = u'1.5.8'
release = u'1.6.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
9 changes: 7 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This is an example of configuration::
'name': 'auth',
'label': 'Authentication',
'icon': 'fa fa-lock',
'default_open': True,
'models': (
{
'name': 'user',
Expand Down Expand Up @@ -142,6 +143,8 @@ Title and free voices can have children. Children follow these rules:

- children children are ignored (do not place an app voice as child)

Voices with children can specify a ``default_open`` option, used to expand the submenu by default.

Title
^^^^^

Expand All @@ -155,14 +158,14 @@ or ::

{ 'type': 'title', 'label': 'main', 'apps': ('auth', ) },

It accepts children voices.
It accepts children voices, though you can specify the ``default_open`` key.

App
^^^

In order to add an application with all its models to the menu, you need an `app` menu voice.

You must specify the ``type`` and ``name`` keys, optionally an ``icon`` key (you can use FontAwesome classes which are included by default) and a ``models`` key.
You must specify the ``type`` and ``name`` keys, optionally an ``icon`` key (you can use FontAwesome classes which are included by default), a ``default_open`` key and a ``models`` key.

.. important:: If you don't define the models key then the default app models are listed under your app, otherwise only the specified models are listed (in the order you provide).

Expand Down Expand Up @@ -216,6 +219,8 @@ It accepts children voices ::
{ 'type': 'free', 'label': 'Photos', 'url': 'http://www.myphotossite.com' },
] },

Since free voices can have children you can specify the ``default_open`` key.

Analytics
---------

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Everything is done with css (sass and bootstrap mixins), and when the markup nee
Features
--------

- Tested with django 1.10.5, 1.11.1, 2.0, 2.1 and 2.2
- Based on bootstrap 4.3.1 and FontAwesome 5.8.1
- Tested with django >= 1.10.5
- Based on bootstrap 4.5.0 and FontAwesome 5.8.1
- Fully responsive
- Custom and flexible sidebar menu
- Text input filters facility
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='django-baton',
version='1.5.8',
version='1.6.0',
packages=['baton', 'baton.autodiscover', 'baton.templatetags'],
include_package_data=True,
license='MIT License',
Expand Down

0 comments on commit cb4b2d4

Please sign in to comment.