Пример #1
0
 def view(self):
     return [
         m('h1', 'User Form'),
         m(self.form),
         m('h1', 'Users'),
         m('ul', map(lambda u: m('li', u.given_name), state.users()))
     ]
Пример #2
0
def main_content():
    return {
        'view': lambda: m('div.flex.flex-col', [
            m(counter),
            m(counter),
        ])
    }
Пример #3
0
 def view(self):
     return m(
         'div.flex.flex-col.justify-start', [
             m(FireflyLogo()),
             list(map(self._menu_item, self.PAGES))
         ]
     )
Пример #4
0
    def _menu_item(self, page: str):
        if page in self._exclude:
            return None

        return m(
            'div.pl-3.py-1',
            m(m.route.Link, {'href': f'/{page}'}, page)
        )
Пример #5
0
def counter():
    count = 0

    def increment():
        nonlocal count
        count += 1
        console.log(count)

    def decrement():
        nonlocal count
        count -= 1

    return {
        'view':
        lambda vnode: m('div', [
            m('p', f'count: {count}'),
            m('button', {'onclick': increment}, 'Increment'),
            m('button', {'onclick': decrement}, 'Decrement'),
        ])
    }
Пример #6
0
 def view(self):
     return m('div', 'Clients Page')
Пример #7
0
def custom_header():
    return {'view': lambda: m('div', 'bleck')}
Пример #8
0
#  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
#  Public License for more details. You should have received a copy of the GNU Lesser General Public
#  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#  You should have received a copy of the GNU General Public License along with Firefly. If not, see
#  <http://www.gnu.org/licenses/>.
from firefly.ui.web.components.form import Form
from firefly.ui.web.components.layouts.default import Crud, menu_item, crud
from firefly.ui.web.js_libs.mithril import m
from firefly.ui.web.plugins import add_menu_item, add_route
from firefly.ui.web.polyfills import *  # __:skip

from iam.domain.entity.user import User
from iam.domain.entity.client import Client

add_menu_item(m('div.ff-title', 'IAM'))
add_menu_item(m(menu_item('Users', icon='solid/users', route='/iam/users')))
add_menu_item(
    m(menu_item('Clients', icon='solid/mobile-alt', route='/iam/clients')))

crud('iam.User', User, '/iam/users')
crud(
    'iam.Client', Client, '/iam/clients', {
        'fields': [
            'name',
            'grant_type',
            'response_type',
            'scopes',
            'default_redirect_uri',
            'redirect_uris',
            'allowed_response_types',