\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{amihapsari} \pdfinfo{ /Title (table-with-count-method-react.pdf) /Creator (Cheatography) /Author (amihapsari) /Subject (Table with count method react Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A33E8F} \definecolor{LightBackground}{HTML}{F9F2F8} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Table with count method react Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{amihapsari} via \textcolor{DarkBackground}{\uline{cheatography.com/82859/cs/19676/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}amihapsari \\ \uline{cheatography.com/amihapsari} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 22nd May, 2019.\\ Updated 22nd May, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{1.94103 cm} x{3.03597 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Step}} \tn % Row 0 \SetRowColor{LightBackground} 1. new Rails application & rails new dog-app -T \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} 2. directory to access & cd dog-app/ \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} 3. Generate the model & rails g model dog name motto \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} & This creates 2 files: app/models/dog.rb db/migrate/{[}date\_time{]}\_create\_dogs.rb The dog table in our database will have 2 fields: name and motto. \tn % Row Count 12 (+ 6) % Row 4 \SetRowColor{LightBackground} 4. Generate the controller & rails g controller dogs index show new edit \tn % Row Count 14 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{5. The config/routes.rb file also gets automatically updated:} \tn % Row Count 16 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{5. Update the config/routes.rb}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{\seqsplit{Rails.application.routes.draw} do \newline resources :dogs \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{6. migrate our data}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{class CreateDogs \textless{} ActiveRecord::Migration{[}5.2{]} \newline def change \newline create\_table :dogs do |t| \newline t.string :name \newline t.string :motto \newline \newline t.timestamps \newline end \newline end \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{rake db:migrate} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{7. Update the db/migrate/seeds.rb}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{Dog.create(name: 'Nala', motto: 'Born to be wild') \newline Dog.create(name: 'Alex', motto: 'Calm as can be') \newline Dog.create(name: 'Leroy', motto: 'Life of the pawty') \newline Dog.create(name: 'Belle', motto: 'Miss Independent')} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{rake db:seed} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(1).{\bf{config/routes.rb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{1.{\bf{config/routes.rb}} \newline Rails.application.routes.draw do \newline resources :barangs \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(2){\bf{db/migrate/20190510051736\_create\_barangs.rb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{2.{\bf{db/migrate/20190510051736\_create\_barangs.rb}} \newline class CreateBarangs \textless{} ActiveRecord::Migration{[}5.2{]} \newline def change \newline create\_table :barangs do |t| \newline t.string :sku \newline t.string :nama \newline t.integer :kuantitas \newline t.integer :hargaBeli \newline t.integer :hargaJual \newline t.integer :profit \newline \newline t.timestamps \newline end \newline end \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(3).{\bf{db/seeds.rb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{3.{\bf{db/seeds.rb}} \newline Barang.create(sku:'AIR001', nama: 'Air mineral Aqui', kuantitas:10, hargaBeli: 3000, hargaJual: 6000, profit: 3000) \newline Barang.create(sku:'SOF001', nama: 'Choca Chola', kuantitas:20, hargaBeli: 5000, hargaJual: 4500, profit: -500) \newline Barang.create(sku:'SNK001', nama: 'Cheetah Toh', kuantitas:15, hargaBeli: 4000, hargaJual: 5000, profit:1000)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{8. added to your database}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{In order to check if the dogs have been added to your database, run: \newline % Row Count 2 (+ 2) rails console or rails c \newline % Row Count 3 (+ 1) Type in Dog.all and you should see that the 4 dogs have been added. \newline % Row Count 5 (+ 2) FYI. Run rails routes or go to \seqsplit{localhost:3000/rails/info/routes} to see all routes your application is configured to:% Row Count 8 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{9. Read}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Goal: List all dogs}} \newline \newline {\bf{Controller}} — app/controllers/dogs\_controller.rb, index method \newline def index \newline @dogs = Dog.all \newline end \newline \newline {\bf{Index}} — views/dogs/index.html.erb \newline \textless{}ul\textgreater{} \newline \textless{}\% @dogs.each do |dog| \%\textgreater{} \newline \textless{}li\textgreater{}\textless{}\%= link\_to dog.name, dog\_path(dog) \%\textgreater{}\textless{}/li\textgreater{} \newline \textless{}\% end \%\textgreater{} \newline \textless{}/ul\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{10. Read(Show details of specific dog)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Goal}}: Show details of specific dog \newline \newline {\bf{Controller }}— app/controllers/dogs\_controller.rb, show method \newline def show \newline @dog = Dog.find(params{[}:id{]}) \newline end \newline \newline \newline {\bf{Show}} — views/dogs/show.html.erb \newline \textless{}h1\textgreater{}\textless{}\%= @dog.name \%\textgreater{}\textless{}/h1\textgreater{} \newline \textless{}h4\textgreater{}"\textless{}\%= @dog.motto \%\textgreater{}"\textless{}/h4\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(4).{\bf{app/controllers/barangs\_controller.rb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{4.{\bf{app/controllers/barangs\_controller.rb}} \newline class BarangsController \textless{} ApplicationController \newline def index \newline @barangs = Barang.all \newline end \newline \newline def show \newline @barangs = Barang.find(params{[}:id{]}) \newline end \newline \newline def new \newline @barangs = Barang.new \newline @hasilProfit = MathCalculator.send(params{[}:operation{]}, *{[}params{[}:a{]}, params{[};b{]}{]}) \newline render : index \newline end \newline \newline def create \newline @barang = \seqsplit{Barang.create(barang\_params)} \newline \newline redirect\_to barangs\_path \newline end \newline \newline def barang\_params \newline \seqsplit{params.require(:barang).permit(:sku}, :nama, :kuantitas, :hargaBeli, :hargaJual, :profit) \newline end \newline \newline def edit \newline @barang = Barang.find(params{[}:id{]}) \newline end \newline \newline def destroy \newline @barang = Barang.find(params{[}:id{]}) \newline @barang.destroy \newline \newline redirect\_to barangs\_path \newline end \newline \newline def update \newline @barang = Barang.find(params{[}:id{]}) \newline \seqsplit{@barang.update(barang\_params)} \newline \newline redirect\_to barangs\_path \newline end \newline \newline def get\_profit \newline count\_profit = ProfitCalculator.new params{[}:operation{]} \newline @result = \seqsplit{profit\_calculator.calculate} \newline end \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(5){\bf{app/views/barangs/index.html.erb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{5.{\bf{app/views/barangs/index.html.erb}} \newline \textless{}style\textgreater{} \newline table\{ \newline margin-left: auto; \newline margin-right: auto; \newline \} \newline .tabel2 \{ \newline border-collapse: collapse; \newline \} \newline \newline .tabel2, tr, th, td \{ \newline border: 1px solid black; \newline \} \newline \newline \textless{}/style\textgreater{} \newline \newline \textless{}h1\textgreater{}Daftar Barang\textless{}/h1\textgreater{} \newline \newline \newline \textless{}table class='tabel2'\textgreater{} \newline \textless{}thead\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}th\textgreater{}SKU\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Nama\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Kuantitas \textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Harga beli\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Harga jual\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Profit per item\textless{}/th\textgreater{} \newline \textless{}th colspan="2"\textgreater{}Action\textless{}/th\textgreater{} \newline \newline \textless{}/tr\textgreater{} \newline \textless{}/thead\textgreater{} \newline \textless{}tbody\textgreater{} \newline \newline \textless{}\% @barangs.each do |barang| \%\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}td scope="row"\textgreater{}\textless{}\%= barang.sku \%\textgreater{}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}\%= barang.nama\%\textgreater{}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}\%= barang.kuantitas \%\textgreater{}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}\%= barang.hargaBeli \%\textgreater{}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}\%= barang.hargaJual \%\textgreater{}\textless{}/td\textgreater{}\% \newline \textless{}td\textgreater{} \newline \textless{}\% unless @hasilProfit.nil? \%\textgreater{} \newline \textless{}\%= @hasilProfit \%\textgreater{} \newline \textless{}\% end \%\textgreater{} \newline \textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}\%= button\_to 'Edit', \seqsplit{edit\_barang\_path(barang)}, method: 'get'\%\textgreater{}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}\%= button\_to 'Remove', barang\_path(barang), method: 'delete', data: \{ confirm: 'Anda Yakin?' \} \%\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \textless{}\% end \%\textgreater{} \newline \textless{}/tbody\textgreater{} \newline \textless{}/table\textgreater{} \newline \textless{}\%= link\_to "Add a New Barang", new\_barang\_path \%\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(6).{\emph{app/views/barangs/edit.html.erb}}*}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{6.{\emph{app/views/barangs/edit.html.erb}}* \newline \textless{}h1\textgreater{}Edit Barang\textless{}/h1\textgreater{} \newline \newline \newline \textless{}h3\textgreater{}Update Barang Details\textless{}/h3\textgreater{} \newline \textless{}\%= form\_with model: @barang do |form| \%\textgreater{} \newline \textless{}\%= form.text\_field :sku, placeholder: "sku" \%\textgreater{} \newline \textless{}\%= form.text\_field :nama, placeholder: "nama" \%\textgreater{} \newline \textless{}\%= form.number\_field :kuantitas, placeholder: "kuantitas" \%\textgreater{} \newline \textless{}\%= form.number\_field :hargaBeli, placeholder: "hargaBeli" \%\textgreater{} \newline \textless{}\%= form.number\_field :hargaJual, placeholder: "hargaJual" \%\textgreater{} \newline \textless{}\%= form.number\_field :profit, placeholder: "profit" \%\textgreater{} \newline \newline \textless{}\%= form.submit \%\textgreater{} \newline \textless{}\% end \%\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{11. Create(Create a new dog)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Goal}}: Create a new dog \newline \newline {\bf{Controller}} — app/controllers/dogs\_controller.rb, new and create methods \newline def new \newline @dog = Dog.new \newline end \newline \newline def create \newline dog = Dog.create(dog\_params) \newline \newline redirect\_to dogs\_path \newline end \newline \newline private \newline \newline def dog\_params \newline \seqsplit{params.require(:dog).permit(:name}, :motto) \newline end \newline \newline \newline {\bf{New}} — views/dogs/new.html.erb \newline \textless{}h3\textgreater{}Create a Dog\textless{}/h3\textgreater{} \newline \textless{}\%= form\_with model: @dog do |form| \%\textgreater{} \newline \textless{}\%= form.text\_field :name, placeholder: "name" \%\textgreater{} \newline \textless{}\%= form.text\_field :motto, placeholder: "motto" \%\textgreater{} \newline \newline \textless{}\%= form.submit \%\textgreater{} \newline \textless{}\% end \%\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{12.Update}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Goal}} Update details for specific dog \newline {\bf{Controller}} — app/controllers/dogs\_controller.rb, edit and update methods \newline def edit \newline @dog = Dog.find(params{[}:id{]}) \newline end \newline \newline def update \newline @dog = Dog.find(params{[}:id{]}) \newline @dog.update(dog\_params) \newline \newline redirect\_to dog\_path(@dog) \newline end \newline \newline private \newline \newline def dog\_params \newline \seqsplit{params.require(:dog).permit(:name}, :motto) \newline end \newline \newline \newline {\bf{Edit}} — views/dogs/edit.html.erb \newline \textless{}h3\textgreater{}Update Dog Details\textless{}/h3\textgreater{} \newline \textless{}\%= form\_with model: @dog do |form| \%\textgreater{} \newline \textless{}\%= form.text\_field :name, placeholder: "name" \%\textgreater{} \newline \textless{}\%= form.text\_field :motto, placeholder: "motto" \%\textgreater{} \newline \newline \textless{}\%= form.submit \%\textgreater{} \newline \textless{}\% end \%\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{13. Delete(Remove a dog from the database)}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{{\bf{Goal}}: Remove a dog from the database \newline {\bf{Controller }}— app/controllers/dogs\_controller.rb, destroy method \newline \newline \newline def destroy \newline @dog = Dog.find(params{[}:id{]}) \newline @dog.destroy \newline \newline redirect\_to dogs\_path \newline end \newline \newline {\bf{Show}} — views/dogs/show.html.erb \newline \textless{}\%= link\_to 'Remove', @dog, method: :delete, data: \{ confirm: 'Are you sure?' \} \%\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(7).{\bf{app/views/barangs/new.html.erb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{7.{\bf{app/views/barangs/new.html.erb}} \newline \textless{}h1\textgreater{}Buat Data Barang\textless{}/h1\textgreater{} \newline \newline \newline \textless{}h3\textgreater{}Create Barang\textless{}/h3\textgreater{} \newline \textless{}\%= form\_with model: @barangs do |form| \%\textgreater{} \newline \textless{}\%= form.text\_field :sku, placeholder: "sku" \%\textgreater{} \newline \textless{}\%= form.text\_field :nama, placeholder: "nama" \%\textgreater{} \newline \textless{}\%= form.number\_field :kuantitas, placeholder: "kuantitas" \%\textgreater{} \newline \textless{}\%= form.number\_field :hargaBeli, placeholder: "hargaBeli" \%\textgreater{} \newline \textless{}\%= form.number\_field :hargaJual, placeholder: "hargaJual" \%\textgreater{} \newline \textless{}\%= form.number\_field :profit, placeholder: "profit" \%\textgreater{} \newline \newline \textless{}\%= form.submit \%\textgreater{} \newline \textless{}\% end \%\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(8).{\bf{app/views/barangs/show.html.erb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{8.{\bf{app/views/barangs/show.html.erb}} \newline \textless{}h1\textgreater{}Lihat Barang\textless{}/h1\textgreater{} \newline \newline \textless{}h1\textgreater{}\textless{}\%= @barangs.sku \%\textgreater{}\textless{}/h1\textgreater{} \newline \textless{}h4\textgreater{}\textless{}\%= @barangs.nama \%\textgreater{}\textless{}/h4\textgreater{} \newline \textless{}h4\textgreater{}\textless{}\%= @barangs.kuantitas \%\textgreater{}\textless{}/h4\textgreater{} \newline \textless{}h4\textgreater{}\textless{}\%= @barangs.hargaBeli \%\textgreater{}\textless{}/h4\textgreater{} \newline \textless{}h4\textgreater{}\textless{}\%= @barangs.hargaJual \%\textgreater{}\textless{}/h4\textgreater{} \newline \textless{}h4\textgreater{}\textless{}\%= @barangs.profit \%\textgreater{}\textless{}/h4\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{(9).{\bf{lib/math\_calculator.rb}}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{9.{\bf{lib/math\_calculator.rb}} \newline class MathCalculator \newline def calculateProfit(a, b) \newline \# whatever you need to do here \newline a.to\_i - b.to\_i \newline end \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}