Coder Social home page Coder Social logo

corner_stones's People

Contributors

b1nary avatar jone avatar senny avatar siegy22 avatar tonini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

corner_stones's Issues

every element with error-class is treated as error

when you use the module WithInlineErrors to validate the form, every html-element with a css-class "error" is treated as an error. Even if the element is not related to the form.

the problem can be found in the file "with_inline_errors.rb":

all('.error').map do |container|

the solution is that the check for error-elements has to be within the form scope.

selector to find Link for DeletableRows

wouldn't it be better to use the existing functionality of rails than using a new css-class to find the link which is used to delete a record?

so you could use:

def attributes_for_row(row)
  super.merge('Delete-Link' => row.first('td *[data-method=delete]'))
end

instead of:

def attributes_for_row(row)
  super.merge('Delete-Link' => row.first('td .delete-action'))
end

so the user wouldn't have to add a css-class which is only used as identifier.

form: assert on attributes

It should be possible to assert that the form contains a set of attributes. A possible interface could look like:

  • form.attribtues # should return a hash of label, values from the form
  • form.assert_attributes(attribute_hash) # attribute_hash has labels texts as keys and the text as values.

handling for custom form fields

In our forms we have a bunch of special autocompletion fields which do not conform with the implementation for the standard autocompletion field. So corner_stones doesn't work with them.

It would be nice to have a mechanism to provide custom field handlers like:

CornerStones::Form::FieldSelector.add_field_handler(custom_autocompleter)

Or with a config like mechanism:

CornerStones::Form.config do |c|
  c.add_field_handler(custom_autocompleter)
end

corner_stones should check the custom field handlers before the general handlers provided by itself because the custom fields are always subsets of the general handlers.

Table row detection fails

If I have a table row like this:

<thead>
  <tr>
    <th>
      Person
    </th>
  </tr>
</thead>
<tbody>
  <tr>
    <td>
      Jack
    </td>
  </tr>
</tbody>

then the row detection fails. CornerStones::Table gives me the following results:

table.rows # => [{"Person"=>"\nJack\n"}]
table.row('Person' => 'Jack') # => nil

This is due to the fact that the row detection checks for string equality.

form#attributes should return option text for selects

the current implementations returns the value of the selected option tags. This isn't that useful when writing tests, since you want to check on the text you've selected. I think we should change form#attributes to return the text from the selected option tag.

table: handling of colspan

@senny

i've got a little question about the handling of colspans in corner_stones:

at the moment a cell with colspan is handled like a normal cell without colspan e.g.:

<table>
  <tr>
    <th>Date</th>
    <th>State</th>
   <th>Sum</th>
  </tr>
  <tr>
    <td colspan="2">Total</td>
    <td>1000</td>
  </tr>
</table>

with this table you get the following row-hash:

{ 'Date' => 'Total', 'State' => 1000, 'Sum' => nil }

i would expect the following:

{ 'Date' => 'Total', 'State' => nil, 'Sum' => 1000 }

or even that:

{ 'Date' => 'Total', 'Sum' => 1000 }

what do you think about that?

navigation component

we need an object to represent a page navigation. It should support the following protocol:

  • open navigate to the page
  • items list of all the possible navigation links

table: pagination support

we need an extension for a table to allow pagination. The interface could look something like:

  • next_page navigate to the next page
  • previous_page navigate to the previous page
  • open_page(number) jump to the page number

The methods should raise an error when navigating in the desired direction is not possible.

Different cases for UnknownFieldErrors

Currently the UnknownFieldError is raised under different circumstances. The name suggests, that the field was found but corner_stones does not know how to handle it:

don't know how to fill the field veranstaltung_sektion (CornerStones::Form::UnknownFieldError)

This could happen with custom inputs, or html5 fields we haven't implemented at the moment.

On the other hand this error also occurs, when there is no such field on the page, or when there is a label with the right name but the for attribute does not point to a valid field.

I think we should either change the error-message to explain the cause better or raise a different error when the field is not on the page.

form#attributes should ignore required text

Currently form#attributes returns the full label text, which includes the "*" for required fields. This makes writing tests much harder since the field-names change when validations change.

Our required text is contained within the following html: <abbr title="required">*</abbr>
I think we should filter the abbr from the text used in the attributes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.