Created
June 25, 2020 11:03
-
-
Save mbtools/043d8ee6e449bc6576412963815f1957 to your computer and use it in GitHub Desktop.
abapGit Popup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ABAPGIT COMMON CSS | |
*/ | |
/* GLOBALS */ | |
body { | |
overflow-x: hidden; | |
} | |
a, a:visited { | |
text-decoration: none; | |
} | |
a:hover, a:active { | |
cursor: pointer; | |
text-decoration: underline; | |
} | |
img { | |
border-width: 0px; | |
vertical-align: middle; | |
} | |
table { border-collapse: collapse; } | |
pre { display: inline; } | |
sup { | |
vertical-align: top; | |
position: relative; | |
top: -0.5em; | |
font-size: 75%; | |
} | |
input, textarea, select { | |
padding: 3px 0.5em; | |
border: 1px solid; | |
} | |
input:focus, textarea:focus { | |
border: 1px solid; | |
} | |
.cursor-pointer { | |
cursor: pointer; | |
} | |
/* MODIFIERS */ | |
.emphasis { font-weight: bold !important; } | |
.crossout { text-decoration: line-through !important; } | |
.right { text-align:right; } | |
.center { text-align:center; } | |
.paddings { padding: 0.5em 0.5em; } | |
.pad-sides { padding-left: 0.3em; padding-right: 0.3em; } | |
.margin-v5 { margin-top: 0.5em; margin-bottom: 0.5em; } | |
.indent5em { padding-left: 0.5em; } | |
.pad4px { padding: 4px; } | |
.w100 { width: 100%; } | |
.wmin { width: 1%; } | |
.w40 { width: 40%; } | |
.float-right { float: right; } | |
.pad-right { padding-right: 6px; } | |
.inline { display: inline; } | |
.hidden { visibility: hidden; } | |
.nodisplay { display: none } | |
.w500px { width: 600px } | |
/* PANELS */ | |
div.panel { | |
border-radius: 3px; | |
} | |
#debug-output { | |
text-align: right; | |
padding-right: 0.5em; | |
font-style: italic; | |
font-size: small; | |
} | |
div.dummydiv { | |
padding: 0.5em 1em; | |
text-align: center; | |
} | |
a.close-btn { | |
text-decoration: none; | |
} | |
/* STRUCTURE DIVS, HEADER & FOOTER */ | |
#abapGitLogo { outline: none; } | |
div#header { | |
padding: 0.5em 0.5em; | |
border-bottom: 3px double; | |
} | |
div#header td:not(.logo) { padding-top: 11px; } /* align with logo H */ | |
div#header td.logo { width: 164px; } | |
div#header td:not(.logo) { padding-top: 11px; } /* align with logo H */ | |
div#header span.page_title { | |
font-weight: normal; | |
font-size: 18pt; | |
padding-left: 0.4em; | |
} | |
div#toc { padding: 0.5em 1em; } | |
div#toc .favorites a { opacity: 0.5; } | |
div#toc .favorites:hover a { opacity: 1; } | |
div#footer { | |
padding: 0.5em 1em; | |
border-top: 3px double; | |
text-align: center; | |
} | |
div#footer span.version { | |
display: block; | |
margin-top: 0.3em; | |
} | |
/* ERROR LOG */ | |
div.log { | |
padding: 6px; | |
margin: 4px; | |
border: 1px solid; | |
border-radius: 4px; | |
} | |
div.log > span { display:block; } | |
div.log .icon { padding-right: 6px; } | |
/* REPOSITORY */ | |
div.repo { | |
margin-top: 3px; | |
padding: 0.5em 1em 0.5em 1em; | |
position: relative; | |
} | |
.repo_name span.name { | |
font-weight: bold; | |
font-size: 14pt; | |
} | |
.repo_name a.url { | |
font-size: 12pt; | |
margin-left: 0.5em; | |
} | |
.repo_name span.url { | |
font-size: 12pt; | |
margin-left: 0.5em; | |
} | |
.repo_name .icon { | |
padding-right: 4px; | |
} | |
.repo_attr { | |
font-size: 12pt; | |
} | |
.repo_attr span { | |
margin-left: 0.2em; | |
margin-right: 0.5em; | |
} | |
.repo_attr span.bg_marker { | |
border: 1px solid; | |
border-radius: 3px; | |
font-size: 8pt; | |
padding: 4px 2px 3px 2px; | |
} | |
.repo_attr span.branch { | |
padding: 2px 4px; | |
border: 1px solid; | |
border-radius: 4px; | |
} | |
/* MISC AND REFACTOR */ | |
.hidden-submit { | |
border: 0 none; | |
height: 0; | |
width: 0; | |
padding: 0; | |
margin: 0; | |
overflow: hidden; | |
} | |
/* STATE BLOCK COMMON*/ | |
span.state-block { | |
margin-left: 1em; | |
font-family: Consolas, Lucida Console, Courier, monospace; | |
font-size: x-small; | |
vertical-align: 13%; | |
display: inline-block; | |
text-align: center; | |
white-space: nowrap; | |
} | |
span.state-block span { | |
display: inline-block; | |
padding: 0px 3px; | |
border-width: 1px; | |
border-style: solid; | |
} | |
/* REPOSITORY TABLE*/ | |
div.repo_container { | |
position: relative; | |
} | |
div.repo_banner { | |
margin: 0em 1.2em 1em; | |
padding: 0.5em 0.5em; | |
text-align: center; | |
font-size: 85%; | |
} | |
table.repo_tab { | |
border: 1px solid; | |
border-radius: 3px; | |
width: 100%; | |
line-height: 1.5; | |
} | |
.repo_tab th { | |
text-align: left; | |
padding: 0.5em; | |
border-bottom: 1px solid; | |
font-weight: normal; | |
} | |
.repo_tab td { | |
border-top: 1px solid; | |
vertical-align: middle; | |
padding-top: 2px; | |
padding-bottom: 2px; | |
} | |
.repo_tab td.icon { | |
width: 1px; | |
text-align: center; | |
padding-left: 8px; | |
padding-right: 4px; | |
} | |
.repo_tab td.icon:not(:first-child) { | |
width: 26px; | |
text-align: left; | |
} | |
.repo_tab td.type { | |
width: 4em; | |
padding-left: 0.5em; | |
} | |
.repo_tab td.object { | |
padding-left: 0.5em; | |
} | |
.repo_tab td.files { | |
padding-left: 0.5em; | |
line-height: 1.5; | |
} | |
.repo_tab td.cmd, .repo_tab th.cmd { | |
text-align: right; | |
padding-left: 0.5em; | |
padding-right: 0.7em; | |
} | |
.repo_tab th.cmd .icon{ | |
padding-right: 8px; | |
} | |
.repo_tab tr:first-child td { border-top: 0px; } | |
.repo_tab tr:hover { | |
background-color: rgb(245, 245, 245) !important; | |
} | |
/* STAGE */ | |
th.stage-status { width: 30px; } | |
th.stage-objtype { width: 30px; } | |
input.stage-filter { width: 18em; } | |
.stage_tab { | |
border: 1px solid; | |
margin-top: 0.2em; | |
line-height: 1.5; | |
} | |
.stage_tab td { | |
border-top: 1px solid; | |
vertical-align: middle; | |
padding: 2px 0.5em; | |
} | |
.stage_tab th { | |
text-align: left; | |
font-weight: normal; | |
padding: 4px 0.5em; | |
} | |
.stage_tab td.status { | |
width: 2em; | |
text-align: center; | |
} | |
.stage_tab td.highlight { | |
font-weight: bold; | |
} | |
.stage_tab tr:hover { | |
background-color: rgb(245, 245, 245) !important; | |
} | |
.stage_tab td.cmd { cursor: pointer; } | |
.stage_tab td.cmd a { padding: 0px 4px; } | |
.stage_tab th.cmd a { padding: 0px 4px; } | |
.stage_tab tbody tr:first-child td { padding-top: 0.5em; } | |
.stage_tab tbody tr:last-child td { padding-bottom: 0.5em; } | |
/* COMMIT */ | |
div.form-container { | |
padding: 1em 1em; | |
} | |
form.aligned-form { | |
display: table; | |
border-spacing: 2px; | |
} | |
form.aligned-form label { | |
padding-right: 1em; | |
vertical-align: middle; | |
} | |
form.aligned-form select { | |
padding-right: 1em; | |
vertical-align: middle; | |
} | |
form.aligned-form span.sub-title { | |
font-size: smaller; | |
padding-top: 8px; | |
} | |
form.aligned-form div.row { display: table-row; } | |
form.aligned-form label { display: table-cell; } | |
form.aligned-form input { display: table-cell; } | |
form.aligned-form input[type="text"] { width: 25em; } | |
form.aligned-form span.cell { display: table-cell; } | |
/* SETTINGS STYLES */ | |
div.settings_container { | |
padding: 0.5em 0.5em 1em; | |
font-size: 10pt; | |
} | |
div.settings_section { | |
margin-left:50px | |
} | |
table.settings td:first-child { | |
padding-left: 1em; | |
padding-right: 1em; | |
} | |
table.settings-package-requirements { | |
/*max-width: 300px;*/ | |
} | |
/* DIFF */ | |
div.diff { | |
padding: 0.7em | |
} | |
div.diff_head { | |
padding-bottom: 0.7em; | |
} | |
span.diff_name { | |
padding-left: 0.5em; | |
} | |
span.diff_changed_by { | |
float: right; | |
} | |
span.diff_changed_by span.user { | |
border-radius: 3px; | |
border: solid 1px; | |
padding: 1px 0.4em; | |
} | |
span.diff_banner { | |
border-style: solid; | |
border-width: 1px; | |
border-radius: 3px; | |
padding-left: 0.3em; | |
padding-right: 0.3em; | |
} | |
div.diff_content { | |
border-top: 1px solid; | |
border-bottom: 1px solid; | |
} | |
div.diff_content tbody tr td{ | |
width: 50%; | |
vertical-align: top | |
} | |
div.diff_head span.state-block { | |
margin-left: 0.5em; | |
font-size: inherit; | |
vertical-align: initial; | |
} | |
div.diff_head span.state-block span { | |
padding: 0px 4px; | |
} | |
/* DIFF TABLE */ | |
table.diff_tab { | |
font-family: Consolas, Courier, monospace; | |
font-size: 10pt; | |
width: 100%; | |
} | |
table.diff_tab td,th { | |
padding-left: 0.5em; | |
padding-right: 0.5em; | |
} | |
table.diff_tab th { | |
text-align: left; | |
font-weight: normal; | |
padding-top: 3px; | |
padding-bottom: 3px; | |
} | |
table.diff_tab thead.header th { | |
text-align: left; | |
font-weight: bold; | |
padding-left: 0.5em; | |
font-size: 9pt; | |
} | |
table.diff_tab td.num, th.num { | |
width: 1%; | |
min-width: 2em; | |
padding-right: 8px; | |
padding-left: 8px; | |
text-align: right !important; | |
border-left: 1px solid; | |
border-right: 1px solid; | |
-ms-user-select: none; | |
user-select: none; | |
} | |
table.diff_tab td.patch, th.patch { | |
width: 1%; | |
min-width: 1.5em; | |
padding-right: 8px; | |
padding-left: 8px; | |
text-align: right !important; | |
border-left: 1px solid; | |
border-right: 1px solid; | |
-ms-user-select: none; | |
user-select: none; | |
cursor: pointer; | |
} | |
table.diff_tab td.num::before { | |
content: attr(line-num); | |
} | |
table.diff_tab code { | |
font-family: inherit; | |
white-space: pre; | |
} | |
table.diff_tab td.code { | |
word-wrap: break-word; | |
white-space: pre-wrap; | |
overflow: visible; | |
} | |
table.diff_tab tbody tr:first-child td { padding-top: 0.5em; } | |
table.diff_tab tbody tr:last-child td { padding-bottom: 0.5em; } | |
table.diff_tab td.mark, th.mark { | |
width: 0.1%; | |
-ms-user-select: none; | |
user-select: none; | |
cursor: default; | |
} | |
.diff_select_left td.diff_right, | |
.diff_select_left td.diff_right *, | |
.diff_select_left th.diff_right, | |
.diff_select_left th.diff_right *, | |
.diff_select_right td.diff_left, | |
.diff_select_right td.diff_left *, | |
.diff_select_right th.diff_left, | |
.diff_select_right th.diff_left * { | |
-ms-user-select: none; | |
user-select: none; | |
cursor: text; | |
} | |
.diff_select_left td.diff_left, | |
.diff_select_left td.diff_left *, | |
.diff_select_left th.diff_left, | |
.diff_select_left th.diff_left *, | |
.diff_select_right td.diff_right, | |
.diff_select_right td.diff_right *, | |
.diff_select_right th.diff_right, | |
.diff_select_right th.diff_right * { | |
-ms-user-select: text; | |
user-select: text; | |
} | |
td.diff_others::selection, | |
td.diff_others *::selection, | |
th.diff_others::selection, | |
th.diff_others *::selection { | |
background-color: transparent; | |
cursor: default; | |
} | |
.diff_select_left td.diff_right::selection, | |
.diff_select_left td.diff_right *::selection, | |
.diff_select_left th.diff_right::selection, | |
.diff_select_left th.diff_right *::selection, | |
.diff_select_right td.diff_left::selection, | |
.diff_select_right td.diff_left *::selection, | |
.diff_select_right th.diff_left::selection, | |
.diff_select_right th.diff_left *::selection { | |
background-color: transparent; | |
cursor: text; | |
} | |
/* DEBUG INFO STYLES */ | |
div.debug_container { | |
padding: 0.5em; | |
font-size: 10pt; | |
font-family: Consolas, Courier, monospace; | |
} | |
div.debug_container p { | |
margin: 0px; | |
} | |
/* DB ENTRIES */ | |
div.db_list { | |
padding: 0.5em; | |
overflow-x: auto; | |
} | |
table.db_tab pre { | |
display: inline-block; | |
overflow: hidden; | |
word-wrap:break-word; | |
white-space: pre-wrap; | |
margin: 0px; | |
width: 30em; | |
} | |
table.db_tab tr.firstrow td { padding-top: 0.5em; } | |
table.db_tab th { | |
text-align: left; | |
padding: 0.5em; | |
border-bottom: 1px solid; | |
} | |
table.db_tab td { | |
padding: 4px 8px; | |
vertical-align: middle; | |
} | |
table.db_tab td.data { | |
font-style: italic; | |
} | |
/* DB ENTRY DISPLAY */ | |
div.db_entry { | |
padding: 0.5em; | |
} | |
div.db_entry pre { | |
display: block; | |
font-size: 10pt; | |
overflow: hidden; | |
word-wrap:break-word; | |
white-space: pre-wrap; | |
border: 1px solid; | |
border-radius: 3px; | |
padding: 0.5em; | |
margin: 0.5em 0em; | |
width: 60em; | |
} | |
div.db_entry textarea { margin: 0.5em 0em; } | |
div.db_entry table.toolbar { | |
width: 50em; | |
} | |
table.tag { | |
display: inline-block; | |
border: 1px solid; | |
border-radius: 3px; | |
margin-right: 0.5em; | |
} | |
table.tag td { padding: 0.2em 0.5em; } | |
/* TUTORIAL */ | |
div.tutorial { | |
margin-top: 3px; | |
padding: 0.5em 1em 0.5em 1em; | |
} | |
div.tutorial li { margin: 2px 0px } | |
div.tutorial h1 { font-size: 18pt; } | |
div.tutorial h2 { font-size: 14pt;} | |
/* MENU */ | |
/* Special credits to example at https://codepen.io/philhoyt/pen/ujHzd */ | |
/* container div, aligned left, | |
but with .float-right modifier alignes right */ | |
.nav-container ul { | |
list-style: none; | |
position: relative; | |
float: left; | |
margin: 0; | |
padding: 0; | |
white-space: nowrap; | |
text-align: left; | |
} | |
.nav-container.float-right ul { float: right; } | |
.nav-container ul a { | |
display: block; | |
text-decoration: none; | |
line-height: 30px; | |
padding: 0 12px; | |
} | |
/* clearfix https://css-tricks.com/snippets/css/clear-fix/ */ | |
.nav-container:after { clear: both; display: block; content: ""; } | |
/* submenues align to left or right border of the active item | |
depending on .float-right modifier */ | |
.nav-container ul li { | |
position: relative; | |
float: left; | |
margin: 0; | |
padding: 0; | |
} | |
.nav-container.float-right ul ul { left: auto; right: 0; } | |
.nav-container ul li.current-menu-item { font-weight: 700; } | |
.nav-container ul li.force-nav-hover ul { display: block; } | |
.nav-container ul li:hover > ul { display: block; } | |
/* special selection style for 1st level items (see also .corner below) */ | |
.nav-container ul ul { | |
display: none; | |
position: absolute; | |
top: 100%; | |
left: 0; | |
z-index: 1; | |
padding: 0; | |
box-shadow: 1px 1px 3px 0px #bbb; | |
} | |
.nav-container ul ul li { | |
float: none; | |
min-width: 160px; | |
} | |
.nav-container ul ul a { | |
line-height: 120%; | |
padding: 8px 15px; | |
} | |
.nav-container ul ul ul { | |
top: 0; | |
left: 100%; | |
} | |
.nav-container.float-right ul ul ul { | |
left: auto; | |
right: 100%; | |
} | |
/* Minizone to extent hover area, | |
aligned to the left or to the right of the selected item | |
depending on .float-right modifier */ | |
.nav-container > ul > li > div.minizone { | |
display: none; | |
z-index: 1; | |
position: absolute; | |
padding: 0px; | |
width: 16px; | |
height: 100%; | |
bottom: 0px; | |
left: 100%; | |
} | |
.nav-container > ul > li:hover div.minizone { display: block; } | |
.nav-container.float-right > ul > li > div.minizone { | |
left: auto; | |
right: 100%; | |
} | |
/* icons - text-align strictly left - otherwise look ugly | |
+ bite a bit of left padding for nicer look | |
+ forbids item text wrapping (maybe can be done differently) */ | |
.nav-container ul ul li a .icon { | |
padding-right: 10px; | |
margin-left: -3px; | |
} | |
.nav-container ul.with-icons li { | |
text-align: left; | |
white-space: nowrap; | |
} | |
/* Special .corner modifier - hangs menu at the top right corner | |
and cancels 1st level background coloring */ | |
.nav-container.corner { | |
position: absolute; | |
right: 0px; | |
} | |
/* Toolbar separator style */ | |
.nav-container ul ul li.separator { | |
font-size: x-small; | |
text-align: center; | |
padding: 4px 0; | |
text-transform: uppercase; | |
border-bottom: 1px solid; | |
border-top: 1px solid; | |
} | |
.nav-container ul ul li.separator:first-child { border-top: none; } | |
/* News Announcement */ | |
div.info-panel { | |
position: absolute; | |
z-index: 99; | |
top: 36px; | |
left: 50%; | |
width: 40em; | |
margin-left: -20em; | |
box-shadow: 1px 1px 3px 2px #dcdcdc; | |
} | |
div.info-panel-fixed { | |
position: fixed; | |
top: 15%; | |
} | |
div.info-panel div.info-hint { | |
text-transform: uppercase; | |
font-size: small; | |
padding: 8px 6px 0px; | |
text-align: center; | |
} | |
div.info-panel div.info-title { | |
text-transform: uppercase; | |
font-size: small; | |
padding: 6px; | |
text-align: center; | |
} | |
div.info-panel div.info-title a.close-btn { | |
padding-left: 12px; | |
padding-right: 2px; | |
position: relative; | |
bottom: 1px; | |
} | |
div.info-panel div.info-list { | |
padding: 0.8em 0.7em 1em; | |
} | |
div.info-panel li { | |
padding-left: 10px; | |
list-style-type: none; | |
} | |
div.info-panel h1:first-child { margin: auto; } | |
div.info-panel h1 { | |
font-size: inherit; | |
padding: 6px 4px; | |
margin: 4px auto auto; | |
text-decoration: underline; | |
font-weight: normal; | |
} | |
div.info-panel .version-marker { | |
display: inline-block; | |
margin-left: 20px; | |
border-radius: 3px; | |
padding: 0px 6px; | |
border: 1px solid; | |
} | |
div.info-panel .update { border: 1px solid; } | |
div.info-panel div.info-list td { padding-right: 1em } | |
/* Error message Panel */ | |
div.message-panel { | |
z-index: 99; | |
box-shadow: 2px 2px 4px 0px hsla(0, 0%, 0%, .1); | |
padding: 12px; | |
margin-left: -48%; | |
position: fixed; | |
bottom: 12px; | |
width: 94%; | |
left: 50%; | |
border: 1px solid; | |
border-radius: 5px; | |
border-color: hsl(0, 42%, 64%); | |
background-color: hsla(0, 42%, 90%, 1); | |
} | |
.message-panel-commands { | |
display: none; | |
margin-right: 2em; | |
} | |
.message-panel-commands a { | |
padding: 0em 0.5em; | |
border-left: 1px solid; | |
border-left-color: #ccc; | |
} | |
.message-panel-commands a:first-child { | |
padding-left: 0; | |
border-left: none; | |
} | |
div.message-panel:hover .message-panel-commands { | |
display: block | |
} | |
/* Tooltip text */ | |
.link-hint { | |
line-height: 1em; | |
text-align: center; | |
padding: 5px 15px; | |
border-radius: 4px; | |
/* Position the tooltip text */ | |
position: absolute; | |
z-index: 1; | |
margin-top: -30px; | |
} | |
.link-hint-a { | |
margin-left: -60px; | |
} | |
.link-hint-input { | |
margin-left: -30px; | |
} | |
.link-hint .pending { color: hsla(0, 0%, 0%, 0.2); } | |
/* Tooltip arrow */ | |
.link-hint::after { | |
content: ""; | |
position: absolute; | |
top: 100%; | |
left: 50%; | |
margin-left: -5px; | |
border-width: 5px; | |
border-style: solid; | |
border-color: transparent; | |
} | |
/* HOTKEYS */ | |
ul.hotkeys { | |
list-style-type: none; | |
padding: 0; | |
margin: 0; | |
font-size: smaller; | |
} | |
ul.hotkeys span.key-id { | |
border: 1px solid; | |
border-radius: 3px; | |
padding: 1px 7px; | |
width: 1em; | |
display: inline-block; | |
text-align: center; | |
margin-top: 0.2em; | |
} | |
ul.hotkeys span.key-descr { | |
margin-left: 1.2em; | |
} | |
div.corner-hint { | |
position: fixed; | |
bottom: 10px; | |
right: 10px; | |
border: 1px solid; | |
border-radius: 3px; | |
padding: 4px; | |
font-size: smaller; | |
opacity: 0.5; | |
z-index: 99; | |
} | |
/* Commit popup */ | |
table.commit tr .title { | |
font-weight: bold; | |
vertical-align: top; | |
} | |
/* Repo overview */ | |
.repo-overview { font-size: smaller; } | |
.repo-overview tbody td { height: 2em; } | |
.ro-detail { display: none; } | |
/* Branch Overview Page */ | |
.gitGraph-scrollWrapper, .gitGraph-Wrapper{ | |
overflow-y: hidden; | |
} | |
.gitGraph-scrollWrapper{ | |
overflow-x: auto; | |
height: 20px; | |
} | |
.gitGraph-Wrapper{ | |
overflow-x: hidden; | |
} | |
.gitGraph-HTopScroller { | |
width:1000px; | |
height: 20px; | |
} | |
/* code inspector */ | |
.ci-head { padding: 0.5em 1em; } | |
.ci-head .package-name span { margin-left: 0.3em; } | |
.ci-variant { font-weight: bold; } | |
.ci-result { | |
padding: 6px; | |
margin-top: 4px; | |
} | |
.ci-result li { | |
list-style-type: none; | |
padding: 0.3em 0.8em; | |
margin-top: 6px; | |
border-left: 4px solid; | |
} | |
.ci-result li:first-child { margin-top: 0px; } | |
.ci-result li > span { display: block; } | |
/* Floating buttons */ | |
.floating-button { | |
position: fixed; | |
top: 6em; | |
right: 2.8em; | |
padding: 1em 1.8em; | |
border-radius: 4px; | |
border-width: 1px; | |
border-style: solid; | |
box-shadow: 2px 2px 6px 0px #ccc; | |
cursor: pointer; | |
} | |
/* Command palette */ | |
.cmd-palette { | |
position: absolute; | |
z-index: 99; | |
top: 36px; | |
left: 50%; | |
width: 40em; | |
margin-left: -20em; | |
box-shadow: 1px 1px 3px 2px #dcdcdc; | |
background-color: white; | |
border: solid 2px; | |
padding: 0px 1px; | |
} | |
.cmd-palette input { | |
width: 100%; | |
box-sizing: border-box; | |
} | |
.cmd-palette ul { | |
max-height: 10em; | |
overflow-y: scroll; | |
margin: 4px 0; | |
padding: 2px 4px; | |
} | |
.cmd-palette li { | |
list-style-type: none; | |
cursor: default; | |
padding: 4px 6px; | |
} | |
.cmd-palette li .icon { | |
margin-right: 10px; | |
} | |
/* SETTINGS */ | |
table.settings_tab { | |
border: 1px solid; | |
max-width: 600px; | |
line-height: 1.5; | |
} | |
table.settings_tab th { | |
text-align: left; | |
padding: 0.5em; | |
border-bottom: 1px solid; | |
} | |
table.settings_tab td { | |
text-align: left; | |
padding: 0.3em 0.5em; | |
border-top: 1px solid; | |
} | |
table.settings_tab input { | |
border: none; | |
text-align: center; | |
} | |
settings_tab tr:first-child td { border-top: 0px; } | |
/* DIALOGS */ | |
.dialog input::placeholder { color: #ccc } | |
.dialog input:-ms-input-placeholder { color: #ccc } | |
.dialog { | |
margin: 50px auto; | |
} | |
.dialog form { | |
border: 1px solid #cbcbcb; | |
background-color: #f4f4f4; | |
margin: 1em 1em; | |
padding: 1em 1em; | |
border-radius: 4px; | |
text-align: left; | |
} | |
.dialog form .group { | |
border-bottom: 1px solid #ccc; | |
} | |
.dialog li { | |
padding: 5px 0px; | |
margin-left: -30px; | |
display: block; | |
list-style: none; | |
position: relative; | |
} | |
.dialog li.dialog-commands { | |
text-align: right; | |
margin-top: 12px; | |
} | |
.dialog li.dialog-commands a { | |
border: 1px solid #ccc; | |
cursor: pointer; | |
text-decoration: none; | |
padding: 6px 12px; | |
border-radius: 3px; | |
font-size: smaller; | |
} | |
.dialog li.dialog-commands input[type="submit"] { | |
border: 1px solid #ccc; | |
padding: 6px 12px; | |
border-radius: 3px; | |
cursor: pointer; | |
} | |
.dialog li.dialog-commands input[type="submit"].main { | |
background-color: #64a8ff; | |
color: #fff; | |
border: 1px solid transparent; | |
} | |
.dialog label { | |
color: #444; | |
display: block; | |
font-size: 90%; | |
margin-top: 6px; | |
margin-bottom: 6px; | |
padding-left: 0.5em; | |
} | |
.dialog label em { | |
color: #64a8ff; | |
} | |
.dialog li.error small { | |
color: #ff5959; | |
display: block; | |
font-size: 75%; | |
margin: 4px 0px; | |
padding-left: 0.5em; | |
} | |
.dialog li.error input[type="text"] { | |
border-color: #ff5959; | |
} | |
.dialog .radio-container { | |
border: 1px solid #ddd; | |
background-color: white; | |
display: inline-block; | |
padding: 4px; | |
border-radius: 3px; | |
} | |
.dialog input[type="checkbox"] + label { | |
display: inline-block; | |
} | |
.dialog input[type="text"] { | |
width: 100%; | |
box-sizing : border-box; | |
height: 2.5em; | |
} | |
.dialog .radio-container input[type="radio"] { | |
visibility: hidden; | |
display: none; | |
height: 0px; | |
width: 0px; | |
} | |
.dialog .radio-container input[type="radio"] + label { | |
color: #808080; | |
border: 1px solid transparent; | |
cursor: pointer; | |
width: auto; | |
margin: 0px; | |
padding: 3px 8px; | |
border-radius: 2px; | |
display: inline-block; | |
} | |
.dialog .radio-container input[type="radio"]:checked + label { | |
background-color: #64a8ff; | |
color: #fff; | |
border: 1px solid transparent; | |
} | |
.dialog li.with-command input[type="text"] { | |
/* for a, not submit */ | |
/*padding-right: 2em;*/ | |
} | |
.dialog li.with-command a { | |
/* for a, not submit */ | |
width: 2em; | |
margin-left: -1.8em; | |
} | |
.dialog li.with-command div.input-frame { | |
/*overflow: hidden;*/ | |
padding-right: 1.8em; | |
} | |
.dialog li.with-command input[type="submit"] { | |
/*width: 2em;*/ | |
float: right; | |
height: 2.5em; | |
} | |
.dialog li.with-command input[type="submit"]:hover { | |
background-color: #64a8ff; | |
color: #fff; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLASS zcl_abapgit_gui_page_addonline DEFINITION | |
PUBLIC | |
INHERITING FROM zcl_abapgit_gui_page | |
FINAL | |
CREATE PRIVATE . | |
PUBLIC SECTION. | |
CLASS-METHODS create | |
" TODO importing prefilled form data | |
RETURNING | |
VALUE(ro_page) TYPE REF TO zcl_abapgit_gui_page_addonline | |
RAISING | |
zcx_abapgit_exception. | |
METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION . | |
METHODS constructor | |
RAISING | |
zcx_abapgit_exception. | |
PROTECTED SECTION. | |
METHODS render_content REDEFINITION. | |
PRIVATE SECTION. | |
CONSTANTS: | |
BEGIN OF c_id, | |
url TYPE string VALUE 'url', | |
package TYPE string VALUE 'package', | |
branch_name TYPE string VALUE 'branch_name', | |
display_name TYPE string VALUE 'display_name', | |
folder_logic TYPE string VALUE 'folder_logic', | |
ignore_subpackages TYPE string VALUE 'ignore_subpackages', | |
master_lang_only TYPE string VALUE 'master_lang_only', | |
END OF c_id. | |
CONSTANTS: | |
BEGIN OF c_event, | |
go_back TYPE string VALUE 'go-back', | |
choose_package TYPE string VALUE 'choose-package', | |
create_package TYPE string VALUE 'create-package', | |
choose_branch TYPE string VALUE 'choose-branch', | |
add_online_repo TYPE string VALUE 'add-repo-online', | |
END OF c_event. | |
DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map. | |
DATA mo_form_data TYPE REF TO zcl_abapgit_string_map. | |
METHODS parse_form | |
IMPORTING | |
it_post_data TYPE cnht_post_data_tab | |
RETURNING | |
VALUE(ro_form_data) TYPE REF TO zcl_abapgit_string_map | |
RAISING | |
zcx_abapgit_exception. | |
METHODS validate_form | |
IMPORTING | |
io_form_data TYPE REF TO zcl_abapgit_string_map | |
RETURNING | |
VALUE(ro_validation_log) TYPE REF TO zcl_abapgit_string_map | |
RAISING | |
zcx_abapgit_exception. | |
ENDCLASS. | |
CLASS ZCL_ABAPGIT_GUI_PAGE_ADDONLINE IMPLEMENTATION. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_GUI_PAGE_ADDONLINE->CONSTRUCTOR | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [!CX!] ZCX_ABAPGIT_EXCEPTION | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD constructor. | |
super->constructor( ). | |
ms_control-page_title = 'Clone online repository'. " TODO refactor | |
CREATE OBJECT mo_validation_log. | |
CREATE OBJECT mo_form_data. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_ABAPGIT_GUI_PAGE_ADDONLINE=>CREATE | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [<-()] RO_PAGE TYPE REF TO ZCL_ABAPGIT_GUI_PAGE_ADDONLINE | |
* | [!CX!] ZCX_ABAPGIT_EXCEPTION | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD create. | |
CREATE OBJECT ro_page. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Private Method ZCL_ABAPGIT_GUI_PAGE_ADDONLINE->PARSE_FORM | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IT_POST_DATA TYPE CNHT_POST_DATA_TAB | |
* | [<-()] RO_FORM_DATA TYPE REF TO ZCL_ABAPGIT_STRING_MAP | |
* | [!CX!] ZCX_ABAPGIT_EXCEPTION | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD parse_form. | |
DATA lt_form TYPE tihttpnvp. | |
DATA ls_field LIKE LINE OF lt_form. | |
lt_form = zcl_abapgit_html_action_utils=>parse_post_data( it_post_data ). | |
CREATE OBJECT ro_form_data. | |
LOOP AT lt_form INTO ls_field. | |
CASE ls_field-name. | |
WHEN c_id-url OR c_id-package OR c_id-branch_name OR c_id-display_name OR c_id-folder_logic. | |
ro_form_data->set( | |
iv_key = ls_field-name | |
iv_val = ls_field-value ). | |
WHEN c_id-ignore_subpackages OR c_id-master_lang_only. " Flags | |
ro_form_data->set( | |
iv_key = ls_field-name | |
iv_val = boolc( ls_field-value = 'on' ) ). | |
WHEN OTHERS. | |
zcx_abapgit_exception=>raise( |Unexpected form field [{ ls_field-name }]| ). | |
ENDCASE. | |
ENDLOOP. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Protected Method ZCL_ABAPGIT_GUI_PAGE_ADDONLINE->RENDER_CONTENT | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [<-()] RI_HTML TYPE REF TO ZIF_ABAPGIT_HTML | |
* | [!CX!] ZCX_ABAPGIT_EXCEPTION | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD render_content. | |
DATA lo_form TYPE REF TO zcl_abapgit_html_form. | |
ri_html = zcl_abapgit_html=>create( ). | |
lo_form = zcl_abapgit_html_form=>create( iv_form_id = 'add-repo-online-form' ). | |
" Repository Settings | |
lo_form->text( | |
iv_group = 'Repository Settings' | |
iv_name = c_id-url | |
iv_required = abap_true | |
iv_label = 'Git repository URL' | |
iv_hint = 'HTTPS address of the repository to clone' | |
iv_placeholder = 'https://github.com/...git' ). | |
lo_form->text( | |
iv_group = 'Repository Settings' | |
iv_name = c_id-package | |
iv_side_action = c_event-choose_package | |
iv_required = abap_true | |
iv_label = 'Package' | |
iv_hint = 'SAP package for the code (should be a dedicated one)' | |
iv_placeholder = 'Z... / $...' ). | |
lo_form->text( | |
iv_group = 'Repository Settings' | |
iv_name = c_id-branch_name | |
iv_side_action = c_event-choose_branch | |
iv_label = 'Branch' | |
iv_hint = 'Switch to a specific branch on clone (default: master)' | |
iv_placeholder = 'master' ). | |
lo_form->radio( | |
iv_group = 'Repository Settings' | |
iv_name = c_id-folder_logic | |
iv_default_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix | |
iv_label = 'Folder logic' | |
iv_hint = 'Define how package folders are named in the repo (see https://docs.abapgit.org)' ). | |
lo_form->option( | |
iv_label = 'Prefix' | |
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix ). | |
lo_form->option( | |
iv_label = 'Full' | |
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-full ). | |
" Local Settings | |
lo_form->text( | |
iv_group = 'Local Settings' | |
iv_name = c_id-display_name | |
iv_label = 'Display name' | |
iv_hint = 'Name to show instead of original repo name (optional)' ). | |
lo_form->checkbox( | |
iv_group = 'Local Settings' | |
iv_name = c_id-ignore_subpackages | |
iv_label = 'Ignore subpackages' | |
iv_hint = 'Syncronize root package only (see https://docs.abapgit.org)' ). | |
lo_form->checkbox( | |
iv_group = 'Local Settings' | |
iv_name = c_id-master_lang_only | |
iv_label = 'Master language only' | |
iv_hint = 'Ignore translations, serialize just master language' ). | |
" Commands | |
lo_form->command( | |
iv_label = 'Clone online repo' | |
iv_is_main = abap_true | |
iv_action = c_event-add_online_repo ). | |
lo_form->command( | |
iv_label = 'Create package' | |
iv_action = c_event-create_package ). | |
lo_form->command( | |
iv_label = 'Back' | |
iv_action = c_event-go_back ). | |
ri_html->add( lo_form->render( | |
iv_form_class = 'dialog w500px' | |
io_values = mo_form_data | |
io_validation_log = mo_validation_log ) ). | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Private Method ZCL_ABAPGIT_GUI_PAGE_ADDONLINE->VALIDATE_FORM | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IO_FORM_DATA TYPE REF TO ZCL_ABAPGIT_STRING_MAP | |
* | [<-()] RO_VALIDATION_LOG TYPE REF TO ZCL_ABAPGIT_STRING_MAP | |
* | [!CX!] ZCX_ABAPGIT_EXCEPTION | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD validate_form. | |
DATA lx_err TYPE REF TO zcx_abapgit_exception. | |
CREATE OBJECT ro_validation_log. | |
IF io_form_data->get( c_id-url ) IS INITIAL. | |
ro_validation_log->set( | |
iv_key = c_id-url | |
iv_val = 'Url cannot be empty' ). | |
ELSE. | |
TRY. | |
zcl_abapgit_url=>validate( io_form_data->get( c_id-url ) ). | |
CATCH zcx_abapgit_exception INTO lx_err. | |
ro_validation_log->set( | |
iv_key = c_id-url | |
iv_val = lx_err->get_text( ) ). | |
ENDTRY. | |
ENDIF. | |
IF io_form_data->get( c_id-package ) IS INITIAL. | |
ro_validation_log->set( | |
iv_key = c_id-package | |
iv_val = 'Package cannot be empty' ). | |
ELSE. | |
TRY. | |
zcl_abapgit_repo_srv=>get_instance( )->validate_package( | |
iv_package = |{ io_form_data->get( c_id-package ) }| | |
iv_ign_subpkg = |{ io_form_data->get( c_id-ignore_subpackages ) }| ). | |
CATCH zcx_abapgit_exception INTO lx_err. | |
ro_validation_log->set( | |
iv_key = c_id-package | |
iv_val = lx_err->get_text( ) ). | |
ENDTRY. | |
ENDIF. | |
IF io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-prefix | |
AND io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-full. | |
ro_validation_log->set( | |
iv_key = c_id-folder_logic | |
iv_val = |Invalid folder logic { io_form_data->get( c_id-folder_logic ) | |
}. Must be { zif_abapgit_dot_abapgit=>c_folder_logic-prefix | |
} or { zif_abapgit_dot_abapgit=>c_folder_logic-full } | ). | |
ENDIF. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_GUI_PAGE_ADDONLINE->ZIF_ABAPGIT_GUI_EVENT_HANDLER~ON_EVENT | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_ACTION TYPE CLIKE | |
* | [--->] IV_GETDATA TYPE CLIKE(optional) | |
* | [--->] IT_POSTDATA TYPE CNHT_POST_DATA_TAB(optional) | |
* | [<---] EI_PAGE TYPE REF TO ZIF_ABAPGIT_GUI_RENDERABLE | |
* | [<---] EV_STATE TYPE I | |
* | [!CX!] ZCX_ABAPGIT_EXCEPTION | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD zif_abapgit_gui_event_handler~on_event. | |
DATA ls_repo_params TYPE zif_abapgit_services_repo=>ty_repo_params. | |
mo_form_data = parse_form( it_postdata ). " import data from html before re-render | |
CASE iv_action. | |
WHEN c_event-go_back. | |
ev_state = zcl_abapgit_gui=>c_event_state-go_back. | |
WHEN c_event-create_package. | |
mo_form_data->set( | |
iv_key = c_id-package | |
iv_val = zcl_abapgit_services_basis=>create_package( ) ). | |
IF mo_form_data->get( c_id-package ) IS NOT INITIAL. | |
ev_state = zcl_abapgit_gui=>c_event_state-re_render. | |
ELSE. | |
ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. | |
ENDIF. | |
WHEN c_event-choose_package. | |
mo_form_data->set( | |
iv_key = c_id-package | |
iv_val = zcl_abapgit_ui_factory=>get_popups( )->popup_search_help( 'TDEVC-DEVCLASS' ) ). | |
IF mo_form_data->get( c_id-package ) IS NOT INITIAL. | |
ev_state = zcl_abapgit_gui=>c_event_state-re_render. | |
ELSE. | |
ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. | |
ENDIF. | |
WHEN c_event-choose_branch. | |
mo_validation_log = validate_form( mo_form_data ). | |
IF mo_validation_log->has( c_id-url ) = abap_true. | |
ev_state = zcl_abapgit_gui=>c_event_state-re_render. " Display errors | |
ENDIF. | |
mo_form_data->set( | |
iv_key = c_id-branch_name | |
iv_val = zcl_abapgit_ui_factory=>get_popups( )->branch_list_popup( mo_form_data->get( c_id-url ) )-name ). | |
IF mo_form_data->get( c_id-branch_name ) IS INITIAL. | |
ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. | |
ELSE. | |
mo_form_data->set( | |
iv_key = c_id-branch_name | |
iv_val = replace( " strip technical | |
val = mo_form_data->get( c_id-branch_name ) | |
sub = 'refs/heads/' | |
with = '' ) ). | |
ev_state = zcl_abapgit_gui=>c_event_state-re_render. | |
ENDIF. | |
WHEN c_event-add_online_repo. | |
mo_validation_log = validate_form( mo_form_data ). | |
IF mo_validation_log->is_empty( ) = abap_true. | |
mo_form_data->to_abap( CHANGING cs_container = ls_repo_params ). | |
zcl_abapgit_services_repo=>new_online( ls_repo_params ). | |
ev_state = zcl_abapgit_gui=>c_event_state-go_back. | |
ELSE. | |
ev_state = zcl_abapgit_gui=>c_event_state-re_render. " Display errors | |
ENDIF. | |
ENDCASE. | |
IF ev_state IS INITIAL. " TODO !!! Refactor this disaster !!! | |
super->zif_abapgit_gui_event_handler~on_event( | |
EXPORTING | |
iv_action = iv_action | |
iv_getdata = iv_getdata | |
it_postdata = it_postdata | |
IMPORTING | |
ei_page = ei_page | |
ev_state = ev_state ). | |
ENDIF. | |
ENDMETHOD. | |
ENDCLASS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLASS zcl_abapgit_html_form DEFINITION | |
PUBLIC | |
FINAL | |
CREATE PRIVATE . | |
PUBLIC SECTION. | |
CLASS-METHODS create | |
IMPORTING | |
iv_form_id TYPE string OPTIONAL | |
RETURNING | |
VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form. | |
METHODS render | |
IMPORTING | |
iv_form_class TYPE string | |
io_values TYPE REF TO zcl_abapgit_string_map | |
io_validation_log TYPE REF TO zcl_abapgit_string_map OPTIONAL | |
RETURNING | |
VALUE(ri_html) TYPE REF TO zif_abapgit_html. | |
METHODS command | |
IMPORTING | |
iv_label TYPE string | |
iv_action TYPE string | |
iv_is_main TYPE abap_bool DEFAULT abap_false | |
iv_as_a TYPE abap_bool DEFAULT abap_false. | |
METHODS text | |
IMPORTING | |
iv_label TYPE string | |
iv_name TYPE string | |
iv_group TYPE string OPTIONAL | |
iv_hint TYPE string OPTIONAL | |
iv_required TYPE abap_bool DEFAULT abap_false | |
iv_placeholder TYPE string OPTIONAL | |
iv_side_action TYPE string OPTIONAL. | |
METHODS checkbox | |
IMPORTING | |
iv_label TYPE string | |
iv_name TYPE string | |
iv_group TYPE string OPTIONAL | |
iv_hint TYPE string OPTIONAL. | |
METHODS radio | |
IMPORTING | |
iv_label TYPE string | |
iv_name TYPE string | |
iv_group TYPE string OPTIONAL | |
iv_default_value TYPE string OPTIONAL | |
iv_hint TYPE string OPTIONAL. | |
METHODS option | |
IMPORTING | |
iv_label TYPE string | |
iv_value TYPE string. | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
TYPES: | |
BEGIN OF ty_subitem, | |
label TYPE string, | |
value TYPE string, | |
END OF ty_subitem. | |
TYPES: | |
tty_subitems TYPE STANDARD TABLE OF ty_subitem WITH DEFAULT KEY. | |
TYPES: | |
BEGIN OF ty_field, | |
group TYPE string, | |
type TYPE i, | |
name TYPE string, | |
label TYPE string, | |
hint TYPE string, | |
dblclick TYPE string, | |
placeholder TYPE string, | |
required TYPE string, | |
item_class TYPE string, | |
error TYPE string, | |
default_value TYPE string, | |
side_action TYPE string, | |
subitems TYPE tty_subitems, | |
* onclick ??? | |
END OF ty_field. | |
TYPES: | |
BEGIN OF ty_command, | |
label TYPE string, | |
action TYPE string, | |
is_main TYPE abap_bool, | |
as_a TYPE abap_bool, | |
* onclick ??? | |
END OF ty_command. | |
CONSTANTS: | |
BEGIN OF c_field_type, | |
text TYPE i VALUE 1, | |
radio TYPE i VALUE 2, | |
checkbox TYPE i VALUE 3, | |
END OF c_field_type. | |
DATA mt_fields TYPE STANDARD TABLE OF ty_field. | |
DATA mt_commands TYPE STANDARD TABLE OF ty_command. | |
DATA mv_form_id TYPE string. | |
CLASS-METHODS render_field | |
IMPORTING | |
ii_html TYPE REF TO zif_abapgit_html | |
io_values TYPE REF TO zcl_abapgit_string_map | |
io_validation_log TYPE REF TO zcl_abapgit_string_map | |
is_field TYPE ty_field. | |
CLASS-METHODS render_command | |
IMPORTING | |
ii_html TYPE REF TO zif_abapgit_html | |
is_cmd TYPE ty_command. | |
ENDCLASS. | |
CLASS ZCL_ABAPGIT_HTML_FORM IMPLEMENTATION. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_HTML_FORM->CHECKBOX | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_LABEL TYPE STRING | |
* | [--->] IV_NAME TYPE STRING | |
* | [--->] IV_GROUP TYPE STRING(optional) | |
* | [--->] IV_HINT TYPE STRING(optional) | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD checkbox. | |
DATA ls_field LIKE LINE OF mt_fields. | |
ls_field-type = c_field_type-checkbox. | |
ls_field-name = iv_name. | |
ls_field-label = iv_label. | |
ls_field-group = iv_group. | |
IF iv_hint IS NOT INITIAL. | |
ls_field-hint = | title="{ iv_hint }"|. | |
ENDIF. | |
APPEND ls_field TO mt_fields. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_HTML_FORM->COMMAND | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_LABEL TYPE STRING | |
* | [--->] IV_ACTION TYPE STRING | |
* | [--->] IV_IS_MAIN TYPE ABAP_BOOL (default =ABAP_FALSE) | |
* | [--->] IV_AS_A TYPE ABAP_BOOL (default =ABAP_FALSE) | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD command. | |
DATA ls_cmd LIKE LINE OF mt_commands. | |
ASSERT iv_as_a IS INITIAL OR iv_is_main IS INITIAL. | |
ls_cmd-label = iv_label. | |
ls_cmd-action = iv_action. | |
ls_cmd-is_main = iv_is_main. | |
ls_cmd-as_a = iv_as_a. | |
APPEND ls_cmd TO mt_commands. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_ABAPGIT_HTML_FORM=>CREATE | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_FORM_ID TYPE STRING(optional) | |
* | [<-()] RO_FORM TYPE REF TO ZCL_ABAPGIT_HTML_FORM | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD create. | |
CREATE OBJECT ro_form. | |
ro_form->mv_form_id = iv_form_id. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_HTML_FORM->OPTION | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_LABEL TYPE STRING | |
* | [--->] IV_VALUE TYPE STRING | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD option. | |
FIELD-SYMBOLS <ls_last> LIKE LINE OF mt_fields. | |
DATA ls_option LIKE LINE OF <ls_last>-subitems. | |
DATA lv_size TYPE i. | |
lv_size = lines( mt_fields ). | |
ASSERT lv_size > 0. " Exception ? Maybe add zcx_no_check ? | |
READ TABLE mt_fields INDEX lv_size ASSIGNING <ls_last>. | |
ASSERT sy-subrc = 0. | |
ASSERT <ls_last>-type = c_field_type-radio. " Or dropdown - TODO in future | |
ls_option-label = iv_label. | |
ls_option-value = iv_value. | |
APPEND ls_option TO <ls_last>-subitems. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_HTML_FORM->RADIO | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_LABEL TYPE STRING | |
* | [--->] IV_NAME TYPE STRING | |
* | [--->] IV_GROUP TYPE STRING(optional) | |
* | [--->] IV_DEFAULT_VALUE TYPE STRING(optional) | |
* | [--->] IV_HINT TYPE STRING(optional) | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD radio. | |
DATA ls_field LIKE LINE OF mt_fields. | |
ls_field-type = c_field_type-radio. | |
ls_field-name = iv_name. | |
ls_field-label = iv_label. | |
ls_field-default_value = iv_default_value. | |
ls_field-group = iv_group. | |
IF iv_hint IS NOT INITIAL. | |
ls_field-hint = | title="{ iv_hint }"|. | |
ENDIF. | |
APPEND ls_field TO mt_fields. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_HTML_FORM->RENDER | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_FORM_CLASS TYPE STRING | |
* | [--->] IO_VALUES TYPE REF TO ZCL_ABAPGIT_STRING_MAP | |
* | [--->] IO_VALIDATION_LOG TYPE REF TO ZCL_ABAPGIT_STRING_MAP(optional) | |
* | [<-()] RI_HTML TYPE REF TO ZIF_ABAPGIT_HTML | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD render. | |
FIELD-SYMBOLS <ls_field> LIKE LINE OF mt_fields. | |
FIELD-SYMBOLS <ls_cmd> LIKE LINE OF mt_commands. | |
ri_html = zcl_abapgit_html=>create( ). | |
ri_html->add( |<div class="{ iv_form_class }">| ). | |
ri_html->add( |<form method="post" id="{ mv_form_id }">| ). | |
LOOP AT mt_fields ASSIGNING <ls_field>. | |
AT NEW group. | |
ri_html->add( |<div class="group">{ <ls_field>-group }</div>| ). | |
ri_html->add( |<ul>| ). | |
ENDAT. | |
render_field( | |
ii_html = ri_html | |
io_values = io_values | |
io_validation_log = io_validation_log | |
is_field = <ls_field> ). | |
AT END OF group. | |
ri_html->add( |</ul>| ). | |
ENDAT. | |
ENDLOOP. | |
ri_html->add( |<ul>| ). | |
ri_html->add( |<li class="dialog-commands">| ). | |
LOOP AT mt_commands ASSIGNING <ls_cmd>. | |
render_command( | |
ii_html = ri_html | |
is_cmd = <ls_cmd> ). | |
ENDLOOP. | |
ri_html->add( |</li>| ). | |
ri_html->add( |</ul>| ). | |
ri_html->add( |</form>| ). | |
ri_html->add( |</div>| ). | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Private Method ZCL_ABAPGIT_HTML_FORM=>RENDER_COMMAND | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] II_HTML TYPE REF TO ZIF_ABAPGIT_HTML | |
* | [--->] IS_CMD TYPE TY_COMMAND | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD render_command. | |
DATA lv_main_submit TYPE string. | |
IF is_cmd-as_a = abap_true. | |
ii_html->add_a( | |
iv_txt = is_cmd-label | |
iv_act = is_cmd-action | |
iv_class = 'dialog-commands' ). | |
ELSE. | |
IF is_cmd-is_main = abap_true. | |
lv_main_submit = ' class="main"'. | |
ELSE. | |
CLEAR lv_main_submit. | |
ENDIF. | |
ii_html->add( |<input type="submit" value="{ | |
is_cmd-label }"{ lv_main_submit } formaction="sapevent:{ is_cmd-action }">| ). | |
ENDIF. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Private Method ZCL_ABAPGIT_HTML_FORM=>RENDER_FIELD | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] II_HTML TYPE REF TO ZIF_ABAPGIT_HTML | |
* | [--->] IO_VALUES TYPE REF TO ZCL_ABAPGIT_STRING_MAP | |
* | [--->] IO_VALIDATION_LOG TYPE REF TO ZCL_ABAPGIT_STRING_MAP | |
* | [--->] IS_FIELD TYPE TY_FIELD | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD render_field. | |
DATA lv_opt_id TYPE string. | |
DATA lv_error TYPE string. | |
DATA lv_value TYPE string. | |
DATA lv_checked TYPE string. | |
DATA lv_item_class TYPE string. | |
FIELD-SYMBOLS <ls_opt> LIKE LINE OF is_field-subitems. | |
" Get value and validation error from maps | |
lv_value = io_values->get( is_field-name ). | |
IF io_validation_log IS BOUND. | |
lv_error = io_validation_log->get( is_field-name ). | |
ENDIF. | |
" Prepare item class | |
lv_item_class = is_field-item_class. | |
IF lv_error IS NOT INITIAL. | |
lv_item_class = condense( lv_item_class && ' error' ). | |
ENDIF. | |
IF lv_item_class IS NOT INITIAL. | |
lv_item_class = | class="{ lv_item_class }"|. | |
ENDIF. | |
" Render field | |
ii_html->add( |<li{ lv_item_class }>| ). | |
CASE is_field-type. | |
WHEN c_field_type-text. | |
ii_html->add( |<label for="{ is_field-name }"{ is_field-hint }>{ | |
is_field-label }{ is_field-required }</label>| ). | |
IF lv_error IS NOT INITIAL. | |
ii_html->add( |<small>{ lv_error }</small>| ). | |
ENDIF. | |
IF is_field-side_action IS NOT INITIAL. | |
ii_html->add( |<input type="submit" value="…" formaction="sapevent:{ is_field-side_action }">| ). | |
ii_html->add( '<div class="input-frame">' ). " Ugly :( | |
ENDIF. | |
ii_html->add( |<input type="text" name="{ is_field-name }" id="{ | |
is_field-name }"{ is_field-placeholder } value="{ lv_value }"{ is_field-dblclick }>| ). | |
IF is_field-side_action IS NOT INITIAL. | |
ii_html->add( '</div>' ). | |
ENDIF. | |
WHEN c_field_type-checkbox. | |
IF lv_error IS NOT INITIAL. | |
ii_html->add( |<small>{ lv_error }</small>| ). | |
ENDIF. | |
IF lv_value IS NOT INITIAL. | |
lv_checked = ' checked'. | |
ENDIF. | |
ii_html->add( |<input type="checkbox" name="{ is_field-name }" id="{ is_field-name }"{ lv_checked }>| ). | |
ii_html->add( |<label for="{ is_field-name }"{ is_field-hint }>{ | |
is_field-label }{ is_field-required }</label>| ). | |
WHEN c_field_type-radio. | |
ii_html->add( |<label{ is_field-hint }>{ is_field-label }{ is_field-required }</label>| ). | |
IF lv_error IS NOT INITIAL. | |
ii_html->add( |<small>{ lv_error }</small>| ). | |
ENDIF. | |
ii_html->add( |<div class="radio-container">| ). | |
LOOP AT is_field-subitems ASSIGNING <ls_opt>. | |
CLEAR lv_checked. | |
IF lv_value = <ls_opt>-value OR ( lv_value IS INITIAL AND <ls_opt>-value = is_field-default_value ). | |
lv_checked = ' checked'. | |
ENDIF. | |
lv_opt_id = |{ is_field-name }{ sy-tabix }|. | |
ii_html->add( |<input type="radio" name="{ is_field-name }" id="{ | |
lv_opt_id }" value="{ <ls_opt>-value }"{ lv_checked }>| ). | |
ii_html->add( |<label for="{ lv_opt_id }">{ <ls_opt>-label }</label>| ). | |
ENDLOOP. | |
ii_html->add( '</div>' ). | |
WHEN OTHERS. | |
ASSERT 1 = 0. | |
ENDCASE. | |
ii_html->add( '</li>' ). | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Instance Public Method ZCL_ABAPGIT_HTML_FORM->TEXT | |
* +-------------------------------------------------------------------------------------------------+ | |
* | [--->] IV_LABEL TYPE STRING | |
* | [--->] IV_NAME TYPE STRING | |
* | [--->] IV_GROUP TYPE STRING(optional) | |
* | [--->] IV_HINT TYPE STRING(optional) | |
* | [--->] IV_REQUIRED TYPE ABAP_BOOL (default =ABAP_FALSE) | |
* | [--->] IV_PLACEHOLDER TYPE STRING(optional) | |
* | [--->] IV_SIDE_ACTION TYPE STRING(optional) | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD text. | |
DATA ls_field LIKE LINE OF mt_fields. | |
ls_field-type = c_field_type-text. | |
ls_field-name = iv_name. | |
ls_field-label = iv_label. | |
ls_field-group = iv_group. | |
IF iv_hint IS NOT INITIAL. | |
ls_field-hint = | title="{ iv_hint }"|. | |
ENDIF. | |
IF iv_side_action IS NOT INITIAL AND mv_form_id IS NOT INITIAL. | |
ls_field-item_class = 'with-command'. | |
ls_field-side_action = iv_side_action. | |
ls_field-dblclick = | ondblclick="document.getElementById('{ mv_form_id | |
}').action = 'sapevent:{ iv_side_action | |
}'; document.getElementById('{ mv_form_id | |
}').submit()"|. | |
ENDIF. | |
IF iv_required = abap_true. | |
ls_field-required = ' <em>*</em>'. | |
ENDIF. | |
IF iv_placeholder IS NOT INITIAL. | |
ls_field-placeholder = | placeholder="{ iv_placeholder }"|. | |
ENDIF. | |
APPEND ls_field TO mt_fields. | |
ENDMETHOD. | |
ENDCLASS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment