hevinci/mockup-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hevinci/mockup-bundle

Composer 安装命令:

composer require hevinci/mockup-bundle

包简介

Utility bundle for mockup creation and export

关键字:

README 文档

README

composer require hevinci/mockup-bundle dev-master

Usage

  1. Create a mockup directory in the Resource/views directory of your bundle. Alternatively, you can do the same in the app directory of your application:
    app
        Resources
            MyVendorMyBundle
                views
                    mockup
  1. Create some mockups within this directory. Mockups are basically twig templates, which might take advantage of the provided library (see below) if needed.

  2. Use the mockup route with the path query parameter to render a particular mockup. For example, the url for rendering the template FooBarBundle::mockup/test.html.twig will be http://localhost/myproject/mockup?path=foobar/test.html. Note that:

    • the path must be prefixed by the name of the bundle in short, lower case notation
    • the mockup path segment must be omitted
    • the .twig extension must be omitted
  3. Use the hevinci:mockup:export command to produce a standalone version of your mockup(s). That command will generate a package containing static html files and all the required assets. Currently this command accept as argument either a bundle name (e.g. FooBarBundle) or a template reference (e.g. FooBarBundle::mockup/test.html.twig)

Map

By default, the hevinci:mockup:export command export all the templates it finds and references them in an index.html file at the root of the generated package. If you want to export only a selection of mockups and/or if you want to sort the mockups in a particular order, you can place a map.yml in your mockup directory:

#FooBarBundle/Resources/views/mockup/map.yml

- mockup-y.html.twig
- mockup-x.html.twig
- baz/mockup-z.html.twig

Library

claroline/layout.html.twig

Provides the basic structure of a claroline page, including the following blocks:

  • title
  • sidebar
  • breadcrumb
  • panelContent
    • panelTitle
    • panelRest
  • modal

claroline/tool.html.twig

Provides a tool layout. Dedicated variables are used to render automatically some parts of the page. For example, the template:

{% extends 'HeVinciMockupBundle::library/claroline/tool.html.twig' %}

{% set toolName = 'My tool' %}
{% set toolSection = 'Administration' %}
{% set toolPage = ['Users', 'Management'] %}

will be rendered as the Users / Management page of an administration tool called "My tool".

Complete list of available variables:

  • toolName: name of the tool
  • toolSection: platform section ("Administration", "Bureau" or "Espace d'activités")
  • toolIcon: short name of the font-awesome icon of the tool
  • toolPage: path of the current page of the tool (breadcrumb)
  • toolWorkspace: name of the workspace of the tool (workspace section only)

claroline/modal.html.twig

Provides a modal dialog skeleton with the following blocks:

  • title
  • body
  • footer

A slot for the modal is already present in the main layout template and all its children. You can include a modal with an embed tag:

{% extends "HevinciMockupBundle::library/claroline/tool.html.twig" %}

{% block modal %}
    {% embed "HeVinciMockupBundle::library/claroline/modal.html.twig" %}
        {% block title %}Titre de la modale...{% endblock %}
        {% block body %}
            <form action="#" method="POST">
                ...
            </form>
        {% endblock %}
    {% endembed %}
{% endblock %}

claroline/resourceManager.html.twig

Provides the layout of the resource manager with one block:

  • resources

This template is a child of tool.html.twig, so the variables associated with it (see above) can also be used:

{% extends 'HeVinciMockupBundle::library/claroline/resourceManager.html.twig' %}

{% set toolSection = 'Espaces d\activités' %}
{% set toolWorkspace = 'Mon espace' %}

{% block resources %}
    ...
{% endblock %}

The template includes a macro for thumbnail creation called resource. This macro accepts a hash of options:

  • name (name of the resource)
  • icon (path to the thumbnail asset)
  • customActions (list of additional actions in the resource menu)

Example:

{% extends 'HeVinciMockupBundle::library/claroline/resourceManager.html.twig' %}
{% import 'HeVinciMockupBundle::library/claroline/resourceManager.html.twig' as macros %}

{% block resources %}
    {{
        macros.resource({
            "name": "Nouvelle ressource",
            "icon": "bundles/foobar/images/res_new.png",
            "customActions": ["Partager", "Exporter"]
        })
    }}
{% endblock %}

TODO

  • Allow to export a particular mockup directory
  • Extend the library

hevinci/mockup-bundle 适用场景与选型建议

hevinci/mockup-bundle 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「mockup」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 hevinci/mockup-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 hevinci/mockup-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 hevinci/mockup-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 3
  • 开发语言: HTML

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-01-19