diff options
| author | Antony Lesuisse <al@openerp.com> | 2012-06-25 10:50:54 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2012-06-25 10:50:54 +0200 |
| commit | 490737c81116020fa6fda9cb677d08b433dbc77f (patch) | |
| tree | f2e14125b07ee501efb5be9c6823bf0b44e91b4e /addons/web/static/src | |
| parent | 2f2dcd29d0c37cd7bc80b7ce4c622fd3510e18eb (diff) | |
| parent | 4a88fba764e2ec12ddbc2038ccdac8467549864e (diff) | |
[MERGE] trunk
bzr revid: al@openerp.com-20120625085054-81zmounxwgv5xo6u
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 418 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 335 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 45 | ||||
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 139 | ||||
| -rw-r--r-- | addons/web/static/src/js/formats.js | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 71 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 12 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 72 |
8 files changed, 474 insertions, 622 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 024ecbbb965..0d4912c2840 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -152,10 +152,13 @@ box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset; } .openerp a.button:active, .openerp a.button.active, .openerp button:active, .openerp button.active, .openerp input[type='submit']:active, .openerp input[type='submit'].active { - background: #e3e3e3; - background: -moz-linear-gradient(top, #e3e3e3, #f6f6f6) #1b468f; - background: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6)) #1b468f; - background: linear-gradient(top, #e3e3e3, #f6f6f6) #1b468f; + background-color: #e3e3e3; + background-image: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6)); + background-image: -webkit-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -moz-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -ms-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -o-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: linear-gradient(to bottom, #e3e3e3, #f6f6f6); -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; @@ -215,8 +218,8 @@ .openerp .oe_bold { font-weight: bold; } -.openerp .oe_inline { - width: auto; +.openerp .oe_inline { + width: auto !important; } .openerp .oe_highlight { color: white; @@ -258,12 +261,21 @@ -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); box-shadow: 0 0 1px rgba(0, 0, 0, 0.2); } +.openerp .oe_title { + width: 55%; +} +.openerp .oe_title:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} .openerp .oe_button_box { width: 200px; text-align: center; } .openerp .oe_avatar { - float: left; margin: 0 16px 0 0; } .openerp .oe_avatar img { @@ -355,34 +367,23 @@ .openerp .ui-tabs-hide { display: none; } -.openerp .oe_dropdown_toggle:after { - width: 0; - height: 0; - display: inline-block; - content: "&darr"; - text-indent: -99999px; - vertical-align: top; - border-left: 4px solid transparent; - border-right: 4px solid transparent; - border-top: 4px solid white; - filter: alpha(opacity=50); - opacity: 0.5; - margin-top: 7px; - margin-left: 6px; - border-top-color: #404040; +.openerp .oe_dropdown, .openerp .oe_dropdown_hover, .openerp .oe_dropdown_toggle { + position: relative; + cursor: pointer; +} +.openerp .oe_dropdown_hover:hover .oe_dropdown_menu, .openerp .oe_dropdown_menu.oe_opened { + display: block; } .openerp .oe_dropdown_menu { display: none; position: absolute; top: 28px; - left: 0px; - padding: 8px; + z-index: 1; border: 1px solid #afafb6; + background: white; + padding: 8px; min-width: 120px; - overflow-x: hidden; - z-index: 900; text-align: left; - background: white; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; @@ -390,14 +391,13 @@ -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); } -.openerp .oe_dropdown_menu li { - position: relative; +.openerp .oe_dropdown_menu > li { list-style-type: none; float: none; display: block; - background-color: none; + position: relative; } -.openerp .oe_dropdown_menu li:hover { +.openerp .oe_dropdown_menu > li:hover { background-color: #f0f0fa; background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); background-image: -webkit-linear-gradient(top, #f0f0fa, #eeeef6); @@ -409,64 +409,47 @@ -webkit-box-shadow: none; box-shadow: none; } -.openerp .oe_dropdown_menu li a { +.openerp .oe_dropdown_menu > li > a { + white-space: nowrap; display: block; padding: 3px 6px; - clear: both; - font-weight: normal; - line-height: 14px; color: #4c4c4c; text-decoration: none; - cursor: pointer; } -.openerp .oe_dropdown_menu li a:hover { +.openerp .oe_dropdown_menu > li > a:hover { text-decoration: none; } -.openerp .oe_dropdown_menu li .oe_sidebar_delete_item { - position: absolute; - bottom: 1px; - right: 4px; - display: none; - width: 12px; - height: 12px; - line-height: 12px; - padding: 1px; - color: #8786b7; - line-height: 8px; - text-align: center; - font-weight: bold; - text-shadow: 0 1px 1px white; -} -.openerp .oe_dropdown_menu li .oe_sidebar_delete_item:hover { - text-decoration: none; - color: white; - background: #8786b7; - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - border-radius: 2px; -} -.openerp .oe_dropdown_menu li:hover .oe_sidebar_delete_item { +.openerp .oe_dropdown_arrow:after { + width: 0; + height: 0; display: inline-block; + content: "&darr"; + text-indent: -99999px; + vertical-align: top; + margin-top: 8px; + margin-left: 4px; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #404040; + filter: alpha(opacity=50); + opacity: 0.5; } .openerp .oe_sidebar { white-space: nowrap; } -.openerp .oe_sidebar .oe_dropdown_menu li { - padding-right: 16px; -} -.openerp .oe_sidebar .oe_sidebar_add_attachment { +.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment { + height: 20px; cursor: pointer; padding-left: 6px; margin-top: 6px; } -.openerp .oe_sidebar .oe_sidebar_add_attachment span { +.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment span { font-weight: bold; } -.openerp .oe_sidebar .oe_sidebar_add_attachment .oe_hidden_input_file { +.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment .oe_hidden_input_file { width: 200px; } -.openerp .oe_sidebar .oe_sidebar_add_attachment:hover { +.openerp .oe_sidebar .oe_dropdown_menu .oe_sidebar_add_attachment:hover { background-color: #f0f0fa; background-image: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); background-image: -webkit-linear-gradient(top, #f0f0fa, #eeeef6); @@ -478,6 +461,32 @@ -webkit-box-shadow: none; box-shadow: none; } +.openerp .oe_sidebar .oe_dropdown_menu li .oe_sidebar_delete_item { + position: absolute; + top: 4px; + right: 4px; + display: none; + width: 12px; + height: 12px; + padding: 1px; + color: #8786b7; + line-height: 8px; + text-align: center; + font-weight: bold; + text-shadow: 0 1px 1px white; +} +.openerp .oe_sidebar .oe_dropdown_menu li .oe_sidebar_delete_item:hover { + text-decoration: none; + color: white; + background: #8786b7; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; +} +.openerp .oe_sidebar .oe_dropdown_menu li:hover .oe_sidebar_delete_item { + display: inline-block; +} .openerp .oe_loading { display: none; z-index: 100; @@ -678,10 +687,7 @@ background-image: -o-linear-gradient(top, #646060, #262626); background-image: linear-gradient(to bottom, #646060, #262626); } -.openerp .oe_topbar .oe_topbar_item li { - float: left; -} -.openerp .oe_topbar .oe_topbar_item li a { +.openerp .oe_topbar .oe_topbar_item { display: block; padding: 5px 10px 7px; line-height: 20px; @@ -690,7 +696,7 @@ vertical-align: top; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); } -.openerp .oe_topbar .oe_topbar_item li a:hover { +.openerp .oe_topbar .oe_topbar_item:hover { background: #303030; color: white; -moz-box-shadow: 0 1px 2px rgba(255, 255, 255, 0.3) inset; @@ -716,20 +722,40 @@ .openerp .oe_topbar .oe_topbar_avatar { vertical-align: top; } -.openerp .oe_topbar .oe_dropdown_toggle:after { - width: 0; - height: 0; - display: inline-block; - content: "&darr"; - text-indent: -99999px; - vertical-align: top; - margin-top: 8px; - margin-left: 4px; - border-left: 4px solid transparent; - border-right: 4px solid transparent; +.openerp .oe_topbar .oe_dropdown_arrow:after { border-top: 4px solid white; - filter: alpha(opacity=50); - opacity: 0.5; +} +.openerp .oe_topbar .oe_dropdown_menu { + background: #333333; + background: rgba(37, 37, 37, 0.9); + border-color: #999999; + border-color: rgba(0, 0, 0, 0.2); + border-style: solid; + border-width: 0 1px 1px; + -moz-border-radius: 0 0 6px 6px; + -webkit-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +.openerp .oe_topbar .oe_dropdown_menu li { + float: none; +} +.openerp .oe_topbar .oe_dropdown_menu li a { + color: #eeeeee; +} +.openerp .oe_topbar .oe_dropdown_menu li a:hover { + background-color: #292929; + background-image: -webkit-gradient(linear, left top, left bottom, from(#292929), to(#191919)); + background-image: -webkit-linear-gradient(top, #292929, #191919); + background-image: -moz-linear-gradient(top, #292929, #191919); + background-image: -ms-linear-gradient(top, #292929, #191919); + background-image: -o-linear-gradient(top, #292929, #191919); + background-image: linear-gradient(to bottom, #292929, #191919); + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; } .openerp .oe_leftbar { display: none; @@ -778,66 +804,8 @@ list-style-type: none; float: left; } -.openerp .oe_user_menu .oe_dropdown { - position: relative; -} -.openerp .oe_user_menu .oe_dropdown_options { - float: left; - background: #333333; - background: rgba(37, 37, 37, 0.9); - display: none; - position: absolute; - top: 32px; +.openerp .oe_user_menu .oe_dropdown_menu { right: -1px; - border: 0; - z-index: 900; - margin-left: 0; - margin-right: 0; - padding: 6px 0; - zoom: 1; - border-color: #999999; - border-color: rgba(0, 0, 0, 0.2); - border-style: solid; - border-width: 0 1px 1px; - -moz-border-radius: 0 0 6px 6px; - -webkit-border-radius: 0 0 6px 6px; - border-radius: 0 0 6px 6px; - -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-background-clip: padding-box; - -moz-background-clip: padding-box; - background-clip: padding-box; -} -.openerp .oe_user_menu .oe_dropdown_options li { - float: none; - display: block; - background-color: none; -} -.openerp .oe_user_menu .oe_dropdown_options li a { - white-space: nowrap; - display: block; - padding: 4px 15px; - clear: both; - font-weight: normal; - line-height: 18px; - color: #eeeeee; -} -.openerp .oe_user_menu .oe_dropdown_options li a:hover { - background-color: #292929; - background-image: -webkit-gradient(linear, left top, left bottom, from(#292929), to(#191919)); - background-image: -webkit-linear-gradient(top, #292929, #191919); - background-image: -moz-linear-gradient(top, #292929, #191919); - background-image: -ms-linear-gradient(top, #292929, #191919); - background-image: -o-linear-gradient(top, #292929, #191919); - background-image: linear-gradient(to bottom, #292929, #191919); - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; -} -.openerp .oe_user_menu .oe_dropdown_options li hr { - border-top: 1px solid #999999; - border-bottom: 0; } .openerp .oe_systray > div { float: left; @@ -846,61 +814,6 @@ .openerp .oe_systray { float: right; } -.openerp .oe_systray .oe_systray_dropdown { - position: relative; -} -.openerp .oe_systray .oe_systray_dropdown:hover .oe_systray_dropdown_options { - display: block; -} -.openerp .oe_systray .oe_systray_dropdown_options { - background: #333333; - background: rgba(37, 37, 37, 0.9); - display: none; - position: absolute; - z-index: 900; - border: 0; - margin-left: 0; - margin-right: 0; - padding: 6px 0; - border-color: #999999; - border-color: rgba(0, 0, 0, 0.2); - border-style: solid; - border-width: 0 1px 1px; - -moz-border-radius: 0 0 6px 6px; - -webkit-border-radius: 0 0 6px 6px; - border-radius: 0 0 6px 6px; - -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); - -webkit-background-clip: padding-box; - -moz-background-clip: padding-box; - background-clip: padding-box; -} -.openerp .oe_systray .oe_systray_dropdown_options li { - float: none; - display: block; - background-color: none; -} -.openerp .oe_systray .oe_systray_dropdown_options li a { - display: block; - padding: 4px 15px; - clear: both; - font-weight: normal; - line-height: 18px; - color: #eeeeee; -} -.openerp .oe_systray .oe_systray_dropdown_options li a:hover { - background-color: #292929; - background-image: -webkit-gradient(linear, left top, left bottom, from(#292929), to(#191919)); - background-image: -webkit-linear-gradient(top, #292929, #191919); - background-image: -moz-linear-gradient(top, #292929, #191919); - background-image: -ms-linear-gradient(top, #292929, #191919); - background-image: -o-linear-gradient(top, #292929, #191919); - background-image: linear-gradient(to bottom, #292929, #191919); - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; -} .openerp .oe_menu { float: left; padding: 0; @@ -933,24 +846,6 @@ -webkit-box-shadow: 0 1px 2px rgba(255, 255, 255, 0.3) inset; box-shadow: 0 1px 2px rgba(255, 255, 255, 0.3) inset; } -.openerp .oe_menu_more_container { - position: relative; -} -.openerp .oe_menu_more_container .oe_menu_more { - position: absolute; - padding: 0; - background-color: #646060; - z-index: 1; - border: 1px solid black; - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; -} -.openerp .oe_menu_more_container .oe_menu_more li { - float: none; -} -.openerp .oe_menu_more_container .oe_menu_more li a { - white-space: nowrap; -} .openerp .oe_secondary_menu_section { font-weight: bold; margin-left: 8px; @@ -1185,6 +1080,9 @@ padding: 2px; content: "i"; } +.openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_form:after { + content: "m"; +} .openerp .oe_view_manager .oe_view_manager_switch .oe_vm_switch_graph:after { font-family: "mnmliconsRegular" !important; font-size: 21px; @@ -1628,16 +1526,53 @@ .openerp .oe_form_button_save_dirty:hover { background: #ed6f6a; } -.openerp .oe_form_invisible { - display: none !important; +.openerp .oe_form_editable .oe_highlight { + color: #404040; + background: none; +} +.openerp .oe_form_editable button.oe_highlight { + background-color: #efefef; + background-image: -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8)); + background-image: -webkit-linear-gradient(top, #efefef, #d8d8d8); + background-image: -moz-linear-gradient(top, #efefef, #d8d8d8); + background-image: -ms-linear-gradient(top, #efefef, #d8d8d8); + background-image: -o-linear-gradient(top, #efefef, #d8d8d8); + background-image: linear-gradient(to bottom, #efefef, #d8d8d8); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; +} +.openerp .oe_form_editable button.oe_highlight:active { + background-color: #e3e3e3; + background-image: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6)); + background-image: -webkit-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -moz-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -ms-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: -o-linear-gradient(top, #e3e3e3, #f6f6f6); + background-image: linear-gradient(to bottom, #e3e3e3, #f6f6f6); + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} +.openerp .oe_form_editable button.oe_highlight:hover { + background-color: #f6f6f6; + background-image: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3)); + background-image: -webkit-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: -moz-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: -ms-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: -o-linear-gradient(top, #f6f6f6, #e3e3e3); + background-image: linear-gradient(to bottom, #f6f6f6, #e3e3e3); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; } -.openerp .oe_form_editable .oe_edit_only { +.openerp .oe_form_invisible { display: none !important; } .openerp .oe_form_readonly .oe_edit_only, .openerp .oe_form_readonly .oe_form_field:empty { display: none !important; } -.openerp .oe_form_nosheet > *:not(.oe_form_topbar) { +.openerp .oe_form_nosheet > *:not(header) { margin-left: 10px !important; margin-right: 10px !important; } @@ -1663,16 +1598,6 @@ max-width: 960px; margin: 0 auto; } -.openerp .oe_form_title { - width: 55%; -} -.openerp .oe_form_title:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} .openerp ul.oe_form_steps { height: 30px; padding: 0; @@ -1710,26 +1635,25 @@ font-weight: bold; color: #b33630; } -.openerp .oe_form_subtotal_footer { - width: auto; - float: right; +.openerp .oe_form .oe_subtotal_footer { + width: 1% !important; } -.openerp .oe_form_subtotal_footer td.oe_form_group_cell { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell { text-align: right; - padding: 0; + padding: 0 !important; } -.openerp .oe_form_subtotal_footer td.oe_form_group_cell_label { - border: none; +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell_label { + border-right: none; } -.openerp .oe_form_subtotal_footer .oe_form_field { +.openerp .oe_form .oe_subtotal_footer .oe_form_field { width: auto !important; } -.openerp .oe_form_subtotal_footer .oe_form_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { border-top: 1px solid #cacaca; - font-size: 120%; + font-sie: 120%; font-weight: bold; } -.openerp .oe_form_subtotal_footer label.oe_form_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer label.oe_subtotal_footer_separator { font-weight: bold !important; padding: 2px 8px 2px 0px !important; } @@ -1838,7 +1762,7 @@ .openerp .oe_form .oe_form_field_selection select { width: inherit; } -.openerp .oe_form .oe_form_sheet textarea { +.openerp .oe_form .oe_form_field_text.oe_inline, .openerp .oe_form .oe_form_field_text.oe_inline > textarea { width: 500px; } .openerp .oe_form .oe_form_field_float input { @@ -1924,6 +1848,7 @@ } .openerp .oe_form .oe_form_field_boolean { padding-top: 4px; + width: auto; } .openerp .oe_form .oe_form_field_many2manytags .text-wrap { width: 100% !important; @@ -2072,9 +1997,6 @@ .openerp .oe-listview-content { width: 100%; } -.openerp .oe-listview-content td:first-child, .openerp .oe-listview-content th:first-child { - width: 17px; -} .openerp .oe-listview-content td:first-child:after, .openerp .oe-listview-content th:first-child:after { border-width: 0; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 1d092ef041e..35e1d08e17f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -169,10 +169,7 @@ $colour4: #8a89ba @include box-shadow((0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, .8) inset)) a.button:active, a.button.active, button:active, button.active, input[type='submit']:active, input[type='submit'].active - background: #e3e3e3 - background: -moz-linear-gradient(top, #e3e3e3, #f6f6f6) #1b468f - background: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6)) #1b468f - background: linear-gradient(top, #e3e3e3, #f6f6f6) #1b468f + @include vertical-gradient(#e3e3e3, #f6f6f6) @include box-shadow(none) a.button.disabled, button:disabled, input[type='submit']:disabled @@ -220,8 +217,8 @@ $colour4: #8a89ba color: #888 .oe_bold font-weight: bold - .oe_inline - width: auto + .oe_inline + width: auto !important .oe_highlight color: white background: #DC5F59 @@ -235,11 +232,18 @@ $colour4: #8a89ba @include vertical-gradient(#DF6B66, #BF3A33) //@include vertical-gradient(lighten(#dc5f59, 3%), lighten(#b33630, 3%)) @include box-shadow(0 0 1px rgba(0, 0, 0, 0.2)) + .oe_title + width: 55% + .oe_title:after + content: "." + display: block + height: 0 + clear: both + visibility: hidden .oe_button_box width: 200px text-align: center .oe_avatar - float: left margin: 0 16px 0 0 img height: 50px @@ -311,92 +315,91 @@ $colour4: #8a89ba display: none // }}} // Dropdown {{{ - .oe_dropdown_toggle:after - width: 0 - height: 0 - display: inline-block - content: "&darr" - text-indent: -99999px - vertical-align: top - border-left: 4px solid transparent - border-right: 4px solid transparent - border-top: 4px solid white - @include opacity(0.5) - margin-top: 7px - margin-left: 6px - border-top-color: #404040 + .oe_dropdown, .oe_dropdown_hover, .oe_dropdown_toggle + position: relative + cursor: pointer + .oe_dropdown_hover:hover .oe_dropdown_menu, .oe_dropdown_menu.oe_opened + display: block .oe_dropdown_menu display: none position: absolute top: 28px - left: 0px - padding: 8px + z-index: 1 border: 1px solid #afafb6 + background: white + padding: 8px min-width: 120px - overflow-x: hidden - z-index: 900 text-align: left - background: white @include radius(3px) @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) - li + > li &:hover @include vertical-gradient(#f0f0fa, #eeeef6) @include box-shadow(none) - position: relative list-style-type: none float: none display: block - background-color: none - a + position: relative + > a + white-space: nowrap display: block padding: 3px 6px - clear: both - font-weight: normal - line-height: 14px color: #4c4c4c text-decoration: none - cursor: pointer &:hover text-decoration: none - .oe_sidebar_delete_item - position: absolute - bottom: 1px - right: 4px - display: none - width: 12px - height: 12px - line-height: 12px - padding: 1px - color: #8786b7 - line-height: 8px - text-align: center - font-weight: bold - text-shadow: 0 1px 1px white - &:hover - text-decoration: none - color: white - background: #8786b7 - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4) - @include radius(2px) - &:hover - .oe_sidebar_delete_item - display: inline-block + .oe_dropdown_arrow:after + width: 0 + height: 0 + display: inline-block + content: "&darr" + text-indent: -99999px + vertical-align: top + margin-top: 8px + margin-left: 4px + border-left: 4px solid transparent + border-right: 4px solid transparent + border-top: 4px solid#404040 + @include opacity(0.5) + .oe_sidebar white-space: nowrap - .oe_dropdown_menu li - padding-right: 16px - .oe_sidebar_add_attachment - cursor: pointer - padding-left: 6px - margin-top: 6px - span - font-weight: bold - .oe_hidden_input_file - width: 200px - &:hover - @include vertical-gradient(#f0f0fa, #eeeef6) - @include box-shadow(none) + .oe_dropdown_menu + .oe_sidebar_add_attachment + height: 20px + cursor: pointer + padding-left: 6px + margin-top: 6px + span + font-weight: bold + .oe_hidden_input_file + width: 200px + &:hover + @include vertical-gradient(#f0f0fa, #eeeef6) + @include box-shadow(none) + li + .oe_sidebar_delete_item + position: absolute + top: 4px + right: 4px + display: none + width: 12px + height: 12px + padding: 1px + color: #8786b7 + line-height: 8px + text-align: center + font-weight: bold + text-shadow: 0 1px 1px white + &:hover + text-decoration: none + color: white + background: #8786b7 + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4) + @include radius(2px) + &:hover + .oe_sidebar_delete_item + display: inline-block // }}} // Loading {{{ .oe_loading @@ -552,20 +555,17 @@ $colour4: #8a89ba border-top: solid 1px #d3d3d3 @include vertical-gradient(#646060, #262626) .oe_topbar_item - li - float: left - a - display: block - padding: 5px 10px 7px - line-height: 20px - height: 20px - color: #eee - vertical-align: top - text-shadow: 0 1px 1px rgba(0,0,0,0.2) - &:hover - background: #303030 - color: white - @include box-shadow(0 1px 2px rgba(255,255,255,0.3) inset) + display: block + padding: 5px 10px 7px + line-height: 20px + height: 20px + color: #eee + vertical-align: top + text-shadow: 0 1px 1px rgba(0,0,0,0.2) + &:hover + background: #303030 + color: white + @include box-shadow(0 1px 2px rgba(255,255,255,0.3) inset) .oe_active background: #303030 font-weight: bold @@ -579,19 +579,24 @@ $colour4: #8a89ba @include radius(3px) .oe_topbar_avatar vertical-align: top - .oe_dropdown_toggle:after - width: 0 - height: 0 - display: inline-block - content: "&darr" - text-indent: -99999px - vertical-align: top - margin-top: 8px - margin-left: 4px - border-left: 4px solid transparent - border-right: 4px solid transparent + .oe_dropdown_arrow:after border-top: 4px solid white - @include opacity(0.5) + .oe_dropdown_menu + background: #333 + background: rgba(37,37,37,0.9) + border-color: #999 + border-color: rgba(0, 0, 0, 0.2) + border-style: solid + border-width: 0 1px 1px + @include radius(0 0 6px 6px) + @include background-clip() + li + float: none + a + color: #eee + &:hover + @include vertical-gradient(#292929, #191919) + @include box-shadow(none) // }}} // Webclient.leftbar {{{ .oe_leftbar @@ -635,48 +640,8 @@ $colour4: #8a89ba li list-style-type: none float: left - .oe_dropdown - position: relative - - .oe_dropdown_options - float: left - background: #333 - background: rgba(37,37,37,0.9) - display: none - position: absolute - top: 32px + .oe_dropdown_menu right: -1px - border: 0 - z-index: 900 - margin-left: 0 - margin-right: 0 - padding: 6px 0 - zoom: 1 - border-color: #999 - border-color: rgba(0, 0, 0, 0.2) - border-style: solid - border-width: 0 1px 1px - @include radius(0 0 6px 6px) - @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) - @include background-clip() - li - float: none - display: block - background-color: none - a - white-space: nowrap - display: block - padding: 4px 15px - clear: both - font-weight: normal - line-height: 18px - color: #eee - &:hover - @include vertical-gradient(#292929, #191919) - @include box-shadow(none) - hr - border-top: 1px solid #999 - border-bottom: 0 // }}} // Systray {{{ .oe_systray > div @@ -684,42 +649,6 @@ $colour4: #8a89ba padding: 0 4px 0 4px .oe_systray float: right - - .oe_systray_dropdown - position: relative - .oe_systray_dropdown:hover .oe_systray_dropdown_options - display: block - .oe_systray_dropdown_options - background: #333 - background: rgba(37,37,37,0.9) - display: none - position: absolute - z-index: 900 - border: 0 - margin-left: 0 - margin-right: 0 - padding: 6px 0 - border-color: #999 - border-color: rgba(0, 0, 0, 0.2) - border-style: solid - border-width: 0 1px 1px - @include radius(0 0 6px 6px) - @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) - @include background-clip() - li - float: none - display: block - background-color: none - a - display: block - padding: 4px 15px - clear: both - font-weight: normal - line-height: 18px - color: #eee - &:hover - @include vertical-gradient(#292929, #191919) - @include box-shadow(none) // }}} // Menu {{{ .oe_menu @@ -745,20 +674,6 @@ $colour4: #8a89ba font-weight: bold color: white @include box-shadow(0 1px 2px rgba(255,255,255,0.3) inset) - .oe_menu_more_container - position: relative - .oe_menu_more - position: absolute - padding: 0 - background-color: #646060 - z-index: 1 - border: 1px solid black - border-bottom-left-radius: 5px - border-bottom-right-radius: 5px - li - float: none - a - white-space: nowrap .oe_secondary_menu_section font-weight: bold margin-left: 8px @@ -943,6 +858,8 @@ $colour4: #8a89ba .oe_vm_switch_list:after, .oe_vm_switch_tree:after padding: 2px content: "i" + .oe_vm_switch_form:after + content: "m" .oe_vm_switch_graph:after font-family: "mnmliconsRegular" !important font-size: 21px @@ -1296,14 +1213,25 @@ $colour4: #8a89ba font-weight: bold &:hover background: #ED6F6A + .oe_form_editable + .oe_highlight + color: #404040 + background: none + button.oe_highlight + @include vertical-gradient(#efefef, #d8d8d8) + @include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset)) + button.oe_highlight:active + @include vertical-gradient(#e3e3e3, #f6f6f6) + @include box-shadow(none) + button.oe_highlight:hover + @include vertical-gradient(#f6f6f6, #e3e3e3) + @include box-shadow((0 1px 2px rgba(0, 0, 0, .1), 0 1px 1px rgba(255, 255, 255, .8) inset)) .oe_form_invisible display: none !important - .oe_form_editable .oe_edit_only - display: none !important .oe_form_readonly .oe_edit_only, .oe_form_field:empty display: none !important - .oe_form_nosheet > *:not(.oe_form_topbar) + .oe_form_nosheet > *:not(header) margin-left: 10px !important margin-right: 10px !important // }}} @@ -1322,14 +1250,6 @@ $colour4: #8a89ba min-width: 650px max-width: 960px margin: 0 auto - .oe_form_title - width: 55% - .oe_form_title:after - content: "." - display: block - height: 0 - clear: both - visibility: hidden ul.oe_form_steps height: 30px padding: 0 @@ -1359,21 +1279,20 @@ $colour4: #8a89ba .oe_form_steps_active font-weight: bold color: #b33630 - .oe_form_subtotal_footer - width: auto - float: right + .oe_form .oe_subtotal_footer + width: 1% !important td.oe_form_group_cell text-align: right - padding: 0 + padding: 0 !important td.oe_form_group_cell_label - border: none + border-right: none .oe_form_field width: auto !important - .oe_form_subtotal_footer_separator + .oe_subtotal_footer_separator border-top: 1px solid #cacaca - font-size: 120% + font-sie: 120% font-weight: bold - label.oe_form_subtotal_footer_separator + label.oe_subtotal_footer_separator font-weight: bold !important padding: 2px 8px 2px 0px !important // no sheet in popups @@ -1468,7 +1387,7 @@ $colour4: #8a89ba .oe_form_field_text textarea, .oe_form_field_selection select width: inherit - .oe_form_sheet textarea + .oe_form_field_text.oe_inline, .oe_form_field_text.oe_inline > textarea width: 500px .oe_form_field_float input width: 100px @@ -1528,6 +1447,7 @@ $colour4: #8a89ba white-space: nowrap .oe_form_field_boolean padding-top: 4px + width: auto .oe_form_field_many2manytags .text-wrap width: 100% !important @@ -1664,7 +1584,6 @@ $colour4: #8a89ba .oe-listview-content width: 100% td:first-child, th:first-child - width: 17px &:after border-width: 0 > thead diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index c31f96e0e4f..6d3f506b6ab 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -582,10 +582,6 @@ instance.web.Menu = instance.web.Widget.extend({ this.renderElement(); this.limit_entries(); this.$secondary_menus.html(QWeb.render("Menu.secondary", { widget : this })); - this.$element.on('click', 'a.oe_menu_more_link', function() { - self.$element.find('.oe_menu_more').toggle(); - return false; - }); this.$element.on('click', 'a[data-menu]', this.on_menu_click); this.$secondary_menus.on('click', 'a[data-menu]', this.on_menu_click); // Hide second level submenus @@ -606,16 +602,12 @@ instance.web.Menu = instance.web.Widget.extend({ $index.after($more); $more.find('.oe_menu_more').append($index.next().nextAll()); } - this.do_hide_more(); }, auto_limit_entries: function() { // TODO: auto detect overflow and bind window on resize var width = $(window).width(); return Math.floor(width / 125); }, - do_hide_more: function() { - this.$element.find('.oe_menu_more').hide(); - }, /** * Opens a given menu by id, as if a user had browsed to that menu by hand * except does not trigger any event on the way @@ -676,7 +668,6 @@ instance.web.Menu = instance.web.Widget.extend({ */ menu_click: function(id) { if (id) { - this.do_hide_more(); // find back the menuitem in dom to get the action var $item = this.$element.find('a[data-menu=' + id + ']'); if (!$item.length) { @@ -708,9 +699,8 @@ instance.web.Menu = instance.web.Widget.extend({ * @param {Event} ev the jquery event */ on_menu_click: function(ev) { + ev.preventDefault(); this.menu_click($(ev.currentTarget).data('menu')); - ev.stopPropagation(); - return false; }, }); @@ -723,20 +713,12 @@ instance.web.UserMenu = instance.web.Widget.extend({ start: function() { var self = this; this._super.apply(this, arguments); - $('html').bind('click', function() { - self.$element.find('.oe_dropdown_options').hide(); - }); - this.$element.find('.oe_dropdown_toggle').click(function() { - self.$element.find('.oe_dropdown_options').toggle(); - return false; - }); - this.$element.on('click', '.oe_dropdown_options li a[data-menu]', function() { + this.$element.on('click', '.oe_dropdown_menu li a[data-menu]', function(ev) { + ev.preventDefault(); var f = self['on_menu_' + $(this).data('menu')]; if (f) { f($(this)); } - self.$element.find('.oe_dropdown_options').hide(); - return false; }); }, change_password :function() { @@ -880,6 +862,27 @@ instance.web.WebClient = instance.web.Widget.extend({ this.$element.on('mouseenter', '.oe_systray > div:not([data-tipsy=true])', function() { $(this).attr('data-tipsy', 'true').tipsy().trigger('mouseenter'); }); + this.$element.on('click', '.oe_dropdown_toggle', function(ev) { + var $menu = $(this).find('.oe_dropdown_menu'); + var state = $menu.is('.oe_opened'); + setTimeout(function() { + // Do not alter propagation + $menu.toggleClass('oe_opened', !state); + if (!state) { + // Move $menu if outside window's edge + var doc_width = $(document).width(); + var offset = $menu.offset(); + var menu_width = $menu.width(); + var x = doc_width - offset.left - menu_width - 15; + if (x < 0) { + $menu.offset({ left: offset.left + x }).width(menu_width); + } + } + }, 0); + }); + instance.web.bus.on('click', this, function() { + self.$element.find('.oe_dropdown_menu.oe_opened').removeClass('oe_opened'); + }); }, show_common: function() { var self = this; diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 9b40b62e825..99e134e7bd4 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -224,6 +224,7 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess } return loaded.then(function() { self.on_modules_loaded(); + self.trigger('module_loaded'); if (!no_session_valid_signal) { self.on_session_valid(); } @@ -477,64 +478,6 @@ instance.web.TranslationDataBase = instance.web.Class.extend(/** @lends instance } }); -/** Configure default qweb */ -instance.web._t = new instance.web.TranslationDataBase().build_translation_function(); -/** - * Lazy translation function, only performs the translation when actually - * printed (e.g. inserted into a template) - * - * Useful when defining translatable strings in code evaluated before the - * translation database is loaded, as class attributes or at the top-level of - * an OpenERP Web module - * - * @param {String} s string to translate - * @returns {Object} lazy translation object - */ -instance.web._lt = function (s) { - return {toString: function () { return instance.web._t(s); }} -}; -instance.web.qweb = new QWeb2.Engine(); -instance.web.qweb.debug = ($.deparam($.param.querystring()).debug != undefined); -instance.web.qweb.default_dict = { - '_' : _, - '_t' : instance.web._t -}; -instance.web.qweb.preprocess_node = function() { - // Note that 'this' is the Qweb Node - switch (this.node.nodeType) { - case 3: - case 4: - // Text and CDATAs - var translation = this.node.parentNode.attributes['t-translation']; - if (translation && translation.value === 'off') { - return; - } - var ts = _.str.trim(this.node.data); - if (ts.length === 0) { - return; - } - var tr = instance.web._t(ts); - if (tr !== ts) { - this.node.data = tr; - } - break; - case 1: - // Element - var attr, attrs = ['label', 'title', 'alt']; - while (attr = attrs.pop()) { - if (this.attributes[attr]) { - this.attributes[attr] = instance.web._t(this.attributes[attr]); - } - } - } -}; - -/** Configure blockui */ -if ($.blockUI) { - $.blockUI.defaults.baseZ = 1100; - $.blockUI.defaults.message = '<img src="/web/static/src/img/throbber2.gif">'; -} - /** Custom jQuery plugins */ $.fn.getAttributes = function() { var o = {}; @@ -564,10 +507,6 @@ $.Mutex = (function() { return Mutex; })(); -/** Setup default session */ -instance.connection = new instance.web.Session(); -instance.web.qweb.default_dict['__debug__'] = instance.connection.debug; - $.async_when = function() { var async = false; var def = $.Deferred(); @@ -603,6 +542,79 @@ $.async_when = function() { return old_async_when.apply(this, arguments); }; +/** Setup blockui */ +if ($.blockUI) { + $.blockUI.defaults.baseZ = 1100; + $.blockUI.defaults.message = '<img src="/web/static/src/img/throbber2.gif">'; +} + +/** Setup default session */ +instance.connection = new instance.web.Session(); + +/** Configure default qweb */ +instance.web._t = new instance.web.TranslationDataBase().build_translation_function(); +/** + * Lazy translation function, only performs the translation when actually + * printed (e.g. inserted into a template) + * + * Useful when defining translatable strings in code evaluated before the + * translation database is loaded, as class attributes or at the top-level of + * an OpenERP Web module + * + * @param {String} s string to translate + * @returns {Object} lazy translation object + */ +instance.web._lt = function (s) { + return {toString: function () { return instance.web._t(s); }} +}; +instance.web.qweb = new QWeb2.Engine(); +instance.web.qweb.default_dict['__debug__'] = instance.connection.debug; // Which one ? +instance.web.qweb.debug = instance.connection.debug; +instance.web.qweb.default_dict = { + '_' : _, + '_t' : instance.web._t +}; +instance.web.qweb.preprocess_node = function() { + // Note that 'this' is the Qweb Node + switch (this.node.nodeType) { + case 3: + case 4: + // Text and CDATAs + var translation = this.node.parentNode.attributes['t-translation']; + if (translation && translation.value === 'off') { + return; + } + var ts = _.str.trim(this.node.data); + if (ts.length === 0) { + return; + } + var tr = instance.web._t(ts); + if (tr !== ts) { + this.node.data = tr; + } + break; + case 1: + // Element + var attr, attrs = ['label', 'title', 'alt']; + while (attr = attrs.pop()) { + if (this.attributes[attr]) { + this.attributes[attr] = instance.web._t(this.attributes[attr]); + } + } + } +}; + +/** Setup jQuery timeago */ +var timeago_setup = function () { + var s = $.timeago.settings.strings; + _.each(s, function(v,k) { + if(_.isString(v)) { + s[k] = instance.web._t(v); + } + }); +} +instance.connection.on('module_loaded', this, timeago_setup); + /** * Registry for all the client actions key: tag value: widget */ @@ -612,8 +624,6 @@ instance.web.client_actions = new instance.web.Registry(); * Client action to reload the whole interface. * If params has an entry 'menu_id', it opens the given menu entry. */ -instance.web.client_actions.add("reload", "instance.web.Reload"); - instance.web.Reload = instance.web.Widget.extend({ init: function(parent, params) { this._super(parent); @@ -634,6 +644,7 @@ instance.web.Reload = instance.web.Widget.extend({ window.location = url; } }); +instance.web.client_actions.add("reload", "instance.web.Reload"); }; diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 0f1c71643be..e0ee3359091 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -118,7 +118,9 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { return instance.web.insert_thousand_seps( _.str.sprintf('%d', value)); case 'float': - var precision = descriptor.digits ? descriptor.digits[1] : 2; + var digits = descriptor.digits ? descriptor.digits : [69,2]; + digits = typeof digits === "string" ? py.eval(digits) : digits; + var precision = digits[1]; var formatted = _.str.sprintf('%.' + precision + 'f', value).split('.'); formatted[0] = instance.web.insert_thousand_seps(formatted[0]); return formatted.join(l10n.decimal_point); diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 12651148a0c..556e7fe73b3 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -33,7 +33,7 @@ instance.web.form.FieldManagerMixin = { }; instance.web.views.add('form', 'instance.web.FormView'); -instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form.FieldManagerMixin, { +instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerMixin, { /** * Indicates that this view is not searchable, and thus that no search * view should be displayed (if there is one active). @@ -472,6 +472,7 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. return self.on_processed_onchange(response, processed); } catch(e) { + console.error(e); instance.webclient.crashmanager.on_javascript_exception(e); return $.Deferred().reject(); } @@ -509,6 +510,9 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. } if (result.domain) { function edit_domain(node) { + if (typeof node !== "object") { + return; + } var new_domain = result.domain[node.attrs.name]; if (new_domain) { node.attrs.domain = new_domain; @@ -520,6 +524,7 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. return $.Deferred().resolve(); } catch(e) { console.error(e); + instance.webclient.crashmanager.on_javascript_exception(e); return $.Deferred().reject(); } }, @@ -552,6 +557,7 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. on_button_cancel: function(event) { if (this.can_be_discarded()) { this.set({mode: "view"}); + this.on_record_loaded(this.datarecord); } return false; }, @@ -891,7 +897,7 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. is_create_mode: function() { return !this.datarecord.id; }, -})); +}); /** * Interface to be implemented by rendering engines for the form view. @@ -1438,7 +1444,7 @@ instance.web.form.InvisibilityChangerMixin = { }, }; -instance.web.form.InvisibilityChanger = instance.web.Class.extend(_.extend({}, instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, { +instance.web.form.InvisibilityChanger = instance.web.Class.extend(instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, { init: function(parent, field_manager, invisible_domain, $element) { this.setParent(parent); instance.web.PropertiesMixin.init.call(this); @@ -1446,9 +1452,9 @@ instance.web.form.InvisibilityChanger = instance.web.Class.extend(_.extend({}, i this.$element = $element; this.start(); }, -})); +}); -instance.web.form.FormWidget = instance.web.Widget.extend(_.extend({}, instance.web.form.InvisibilityChangerMixin, { +instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.InvisibilityChangerMixin, { /** * @constructs instance.web.form.FormWidget * @extends instance.web.Widget @@ -1554,7 +1560,7 @@ instance.web.form.FormWidget = instance.web.Widget.extend(_.extend({}, instance. } return final_domain; } -})); +}); instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ template: 'WidgetButton', @@ -1652,7 +1658,7 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ * - changed_value: triggered to inform the view to check on_changes * */ -instance.web.form.FieldMixin = { +instance.web.form.FieldInterface = { /** * Constructor takes 2 arguments: * - field_manager: Implements FieldManagerMixin @@ -1716,7 +1722,7 @@ instance.web.form.FieldMixin = { }; /** - * Abstract class for classes implementing FieldMixin. + * Abstract class for classes implementing FieldInterface. * * Properties: * - effective_readonly: when it is true, the widget is displayed as readonly. Vary depending @@ -1726,7 +1732,7 @@ instance.web.form.FieldMixin = { * a 'changed_value' event that inform the view to trigger on_changes. * */ -instance.web.form.AbstractField = instance.web.form.FormWidget.extend(_.extend({}, instance.web.form.FieldMixin, { +instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.web.form.FieldInterface, { /** * @constructs instance.web.form.AbstractField * @extends instance.web.form.FormWidget @@ -1844,7 +1850,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(_.extend({ set_input_id: function(id) { this.id_for_label = id; }, -})); +}); /** * A mixin to apply on any field that has to completely re-render when its readonly state @@ -1883,7 +1889,7 @@ instance.web.form.ReinitializeFieldMixin = { render_value: function() {}, }; -instance.web.form.FieldChar = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { template: 'FieldChar', widget_class: 'oe_form_field_char', init: function (field_manager, node) { @@ -1928,7 +1934,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(_.extend({} focus: function() { this.delay_focus(this.$element.find('input:first')); } -})); +}); instance.web.form.FieldID = instance.web.form.FieldChar.extend({ @@ -1995,7 +2001,7 @@ instance.web.form.FieldFloat = instance.web.form.FieldChar.extend({ this._super(field_manager, node); this.set({'value': 0}); if (this.node.attrs.digits) { - this.digits = py.eval(node.attrs.digits); + this.digits = this.node.attrs.digits; } else { this.digits = this.field.digits; } @@ -2023,6 +2029,7 @@ instance.web.DateTimeWidget = instance.web.OldWidget.extend({ this.$input_picker = this.$element.find('input.oe_datepicker_container'); this.$input.change(this.on_change); this.picker({ + onClose: this.on_picker_select, onSelect: this.on_picker_select, changeMonth: true, changeYear: true, @@ -2094,7 +2101,7 @@ instance.web.DateWidget = instance.web.DateTimeWidget.extend({ type_of_date: "date" }); -instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { template: "FieldDatetime", build_widget: function() { return new instance.web.DateTimeWidget(this); @@ -2138,7 +2145,7 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(_.exten if (this.datewidget && this.datewidget.$input) this.delay_focus(this.datewidget.$input); } -})); +}); instance.web.form.FieldDate = instance.web.form.FieldDatetime.extend({ template: "FieldDate", @@ -2147,7 +2154,7 @@ instance.web.form.FieldDate = instance.web.form.FieldDatetime.extend({ } }); -instance.web.form.FieldText = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { template: 'FieldText', initialize_content: function() { this.$textarea = this.$element.find('textarea'); @@ -2207,7 +2214,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(_.extend({} $div.remove(); $input.height(new_height); }, -})); +}); instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ template: 'FieldBoolean', @@ -2256,7 +2263,7 @@ instance.web.form.FieldTextXml = instance.web.form.AbstractField.extend({ // to replace view editor }); -instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { template: 'FieldSelection', init: function(field_manager, node) { var self = this; @@ -2324,7 +2331,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(_.exte focus: function() { this.delay_focus(this.$element.find('select:first')); } -})); +}); // jquery autocomplete tweak to allow html (function() { @@ -2409,7 +2416,7 @@ instance.web.form.CompletionFieldMixin = { } // create... values.push({label: _t("<em> Create and Edit...</em>"), action: function() { - self._search_create_popup("form", undefined, {"default_name": search_val}); + self._search_create_popup("form", undefined, {}); }}); return values; @@ -2459,8 +2466,7 @@ instance.web.form.CompletionFieldMixin = { add_id: function(id) {}, }; -instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, - instance.web.form.CompletionFieldMixin, { +instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, { template: "FieldMany2One", init: function(field_manager, node) { this._super(field_manager, node); @@ -2686,7 +2692,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(_.exten focus: function () { this.delay_focus(this.$input); } -})); +}); /* # Values: (0, 0, { fields }) create @@ -3152,8 +3158,7 @@ instance.web.form.One2ManyKanbanView = instance.web_kanban.KanbanView.extend({ }); } -instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.CompletionFieldMixin, - instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, instance.web.form.ReinitializeFieldMixin, { template: "FieldMany2ManyTags", init: function() { this._super.apply(this, arguments); @@ -3277,7 +3282,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(_. add_id: function(id) { this.set({'value': _.uniq(this.get('value').concat([id]))}); }, -})); +}); /* * TODO niv: clean those deferred stuff, it could be better @@ -3412,7 +3417,7 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in } }); -instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.CompletionFieldMixin, { +instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend(instance.web.form.CompletionFieldMixin, { disable_utility_classes: true, init: function(field_manager, node) { this._super(field_manager, node); @@ -3535,7 +3540,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( add_id: function(id) { this.quick_create.add_id(id); }, -})); +}); function m2m_kanban_lazy_init() { if (instance.web.form.Many2ManyKanbanView) @@ -3888,7 +3893,7 @@ instance.web.form.SelectCreateListView = instance.web.ListView.extend({ } }); -instance.web.form.FieldReference = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { template: 'FieldReference', init: function(field_manager, node) { this._super(field_manager, node); @@ -3980,9 +3985,9 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(_.exte } throw Exception("Should not happen"); }, -})); +}); -instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(_.extend({}, instance.web.form.ReinitializeFieldMixin, { +instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { init: function(field_manager, node) { var self = this; this._super(field_manager, node); @@ -4072,7 +4077,7 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(_.extend( } return false; } -})); +}); instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ template: 'FieldBinaryFile', @@ -4285,7 +4290,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ /** * Registry of form fields, called by :js:`instance.web.FormView`. * - * All referenced classes must implement FieldMixin. Those represent the classes whose instances + * All referenced classes must implement FieldInterface. Those represent the classes whose instances * will substitute to the <field> tags as defined in OpenERP's views. */ instance.web.form.widgets = new instance.web.Registry({ diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 7fc27625bcd..95b87e3cd86 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -739,18 +739,9 @@ instance.web.Sidebar = instance.web.Widget.extend({ var self = this; this._super(this); this.redraw(); - this.$element.on('click','.oe_dropdown_toggle',function(event) { - self.$('ul').hide(); - $(this).parent().find('ul').toggle(); - return false; - }); - instance.web.bus.on('click', self, function(ev) { - self.$('ul').hide(); - }); this.$element.on('click','.oe_dropdown_menu li a', function(event) { var section = $(this).data('section'); var index = $(this).data('index'); - $(this).closest('ul').hide(); var item = self.items[section][index]; if (item.callback) { item.callback.apply(self, [item]); @@ -759,13 +750,12 @@ instance.web.Sidebar = instance.web.Widget.extend({ } else if (item.url) { return true; } - return false; + event.preventDefault(); }); }, redraw: function() { var self = this; self.$element.html(QWeb.render('Sidebar', {widget: self})); - this.$element.find('ul').hide(); // Hides Sidebar sections when item list is empty this.$('.oe_form_dropdown_section').each(function() { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index c8af7c3b799..e293ffc7adb 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -273,8 +273,10 @@ </t> <t t-name="Menu.more"> <li class="oe_menu_more_container"> - <a href="#" class="oe_menu_more_link oe_dropdown_toggle">More</a> - <ul class="oe_menu_more" style="display: none;"/> + <span class="oe_topbar_item oe_menu_more_link oe_dropdown_toggle oe_dropdown_arrow"> + More + <ul class="oe_menu_more oe_dropdown_menu"/> + </span> </li> </t> <t t-name="Menu.secondary"> @@ -316,19 +318,15 @@ </t> <t t-name="UserMenu"> - <ul class="oe_user_menu oe_topbar_item"> - <li class="oe_dropdown"> - <a href="#" class="oe_dropdown_toggle"> - <img class="oe_topbar_avatar" t-att-data-default-src="_s + '/web/static/src/img/user_menu_avatar.png'"/> - <span class="oe_topbar_name"/> - </a> - <ul class="oe_dropdown_options"> - <li><a href="#" data-menu="about">About OpenERP</a></li> - <li><a href="#" data-menu="settings">Preferences</a></li> - <li><a href="#" data-menu="logout">Log out</a></li> - </ul> - </li> - </ul> + <span class="oe_user_menu oe_topbar_item oe_dropdown_toggle oe_dropdown_arrow"> + <img class="oe_topbar_avatar" t-att-data-default-src="_s + '/web/static/src/img/user_menu_avatar.png'"/> + <span class="oe_topbar_name"/> + <ul class="oe_dropdown_menu"> + <li><a href="#" data-menu="about">About OpenERP</a></li> + <li><a href="#" data-menu="settings">Preferences</a></li> + <li><a href="#" data-menu="logout">Log out</a></li> + </ul> + </span> </t> <t t-name="UserMenu.about"> <div> @@ -423,8 +421,8 @@ </td> <td> <ul class="oe_view_manager_switch oe_button_group oe_right"> - <t t-if="widget.views_src.length > 2" t-foreach="widget.views_src" t-as="view"> - <li t-if="view.view_type != 'form'" class="oe_e"><a t-attf-class="oe_vm_switch_#{view.view_type}" t-att-data-view-type="view.view_type" t-att-title="_t('Switch to ') + (view.label || view.view_type)"> + <t t-if="widget.views_src.length > 1" t-foreach="widget.views_src" t-as="view"> + <li class="oe_e"><a t-attf-class="oe_vm_switch_#{view.view_type}" t-att-data-view-type="view.view_type" t-att-title="_t('Switch to ') + (view.label || view.view_type)"> </a></li> </t> </ul> @@ -510,25 +508,27 @@ <div class="oe_sidebar"> <t t-foreach="widget.sections" t-as="section"> <div class="oe_form_dropdown_section"> - <button class="oe_dropdown_toggle"><t t-esc="section.label"/></button> - <ul class="oe_dropdown_menu"> - <li t-foreach="widget.items[section.name]" t-as="item" t-att-class="item.classname"> - <a class="oe_sidebar_action_a" t-att-title="item.title" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank"> - <t t-raw="item.label"/> - </a> - <a t-if="section.name == 'files'" class="oe_sidebar_delete_item" t-att-data-id="item.id" title="Delete this attachment">x</a> - </li> - <li t-if="section.name == 'files'" class="oe_sidebar_add_attachment"> - <t t-call="HiddenInputFile"> - <t t-set="fileupload_id" t-value="widget.fileupload_id"/> - <t t-set="fileupload_action">/web/binary/upload_attachment</t> - <input type="hidden" name="model" t-att-value="widget.dataset and widget.dataset.model"/> - <input type="hidden" name="id" t-att-value="widget.model_id"/> - <input type="hidden" name="session_id" t-att-value="widget.session.session_id"/> - <span>Add...</span> - </t> - </li> - </ul> + <button class="oe_dropdown_toggle oe_dropdown_arrow"> + <t t-esc="section.label"/> + <ul class="oe_dropdown_menu"> + <li t-foreach="widget.items[section.name]" t-as="item" t-att-class="item.classname"> + <a class="oe_sidebar_action_a" t-att-title="item.title" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank"> + <t t-raw="item.label"/> + </a> + <a t-if="section.name == 'files'" class="oe_sidebar_delete_item" t-att-data-id="item.id" title="Delete this attachment">x</a> + </li> + <li t-if="section.name == 'files'" class="oe_sidebar_add_attachment"> + <t t-call="HiddenInputFile"> + <t t-set="fileupload_id" t-value="widget.fileupload_id"/> + <t t-set="fileupload_action">/web/binary/upload_attachment</t> + <input type="hidden" name="model" t-att-value="widget.dataset and widget.dataset.model"/> + <input type="hidden" name="id" t-att-value="widget.model_id"/> + <input type="hidden" name="session_id" t-att-value="widget.session.session_id"/> + <span>Add...</span> + </t> + </li> + </ul> + </button> </div> </t> </div> |
